Skip to content

Commit

Permalink
Merge pull request #1 from GTNewHorizons/AlastorsDrathFixes
Browse files Browse the repository at this point in the history
Fixing the EMT Issues (Missing Omni Mode) + Updating the way the Electric Boots Work
  • Loading branch information
Drathonix authored May 6, 2024
2 parents 41953d6 + d06a0f3 commit 277f4d4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/main/java/emt/EMT.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.apache.logging.log4j.Logger;

import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
Expand Down Expand Up @@ -65,12 +66,18 @@ public class EMT {
@Mod.Instance("EMT")
public static EMT instance;

public static boolean isBootsActive = false;
public static final String BOOTS = "thaumicboots";

public boolean isSimulating() {
return !FMLCommonHandler.instance().getEffectiveSide().isClient();
}

@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
if (Loader.isModLoaded(BOOTS)) {
isBootsActive = true;
}
EMTConfigHandler.init(event.getSuggestedConfigurationFile());
FMLCommonHandler.instance().bus().register(new EMTEventHandler());
if (FMLCommonHandler.instance().getSide().isClient()) {
Expand Down
18 changes: 16 additions & 2 deletions src/main/java/emt/item/armor/boots/ItemElectricBootsTraveller.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.event.entity.living.LivingFallEvent;

import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
Expand Down Expand Up @@ -132,7 +133,7 @@ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
player.stepHeight = 1.0F;
}
float speedMod = (float) getSpeedModifier(itemStack);
if (player.onGround) {
if (player.onGround || player.isOnLadder() || player.capabilities.isFlying) {
float bonus = speedBonus;
if (player.isInWater()) {
bonus /= 4.0F;
Expand All @@ -142,7 +143,11 @@ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
bonus /= 2.0F;
}
bonus *= speedMod;
player.moveFlying(player.moveStrafing, player.moveForward, bonus);
if (EMT.isBootsActive) {
applyOmniState(player, bonus, itemStack);
} else {
player.moveFlying(0.0F, player.moveForward, bonus);
}
} else if (Hover.getHover(player.getEntityId())) {
// Base ItemBootsTraveller jumpBonus equals to jumpBonus of Electric Boots,
// so any other boots factor can be calculated via proportion method
Expand All @@ -159,6 +164,15 @@ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
}
}

@Optional.Method(modid = "thaumicboots")
public void applyOmniState(EntityPlayer player, float bonus, ItemStack itemStack) {
if (player.moveStrafing != 0.0 && itemStack.stackTagCompound.getBoolean("omni")) {
player.moveFlying(player.moveStrafing, 0.0F, bonus);
} else if (player.moveForward != 0.0) {
player.moveFlying(0.0F, player.moveForward, bonus);
}
}

@SubscribeEvent
public void onPlayerJump(LivingEvent.LivingJumpEvent event) {
if (event.entityLiving instanceof EntityPlayer) {
Expand Down

0 comments on commit 277f4d4

Please sign in to comment.