Skip to content

Commit

Permalink
updating for intertia + fixing the backwards movement
Browse files Browse the repository at this point in the history
  • Loading branch information
Alastors committed May 28, 2024
1 parent 0e1d5d9 commit 93f048f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 deletions.
6 changes: 3 additions & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Add your dependencies here

dependencies {
compileOnly 'com.github.GTNewHorizons:GT5-Unofficial:5.09.46.05:dev'
compileOnly 'com.github.GTNewHorizons:GT5-Unofficial:5.09.48.09:dev'
api 'com.github.GTNewHorizons:Baubles:1.0.4:dev'
api 'com.github.GTNewHorizons:ModularUI:1.1.42:dev'
api ('com.github.GTNewHorizons:ThaumicBoots:1.3.0:dev'){
api 'com.github.GTNewHorizons:ModularUI:1.2.0:dev'
api ('com.github.GTNewHorizons:ThaumicBoots:1.3.4:dev'){
exclude group: 'com.github.GTNewHorizons', module: 'Electro-Magic-Tools'
}

Expand Down
38 changes: 34 additions & 4 deletions src/main/java/emt/item/armor/boots/ItemElectricBootsTraveller.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,20 @@ public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) {

@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
if (getIntertialState(itemStack) && player.moveForward == 0
&& player.moveStrafing == 0
&& player.capabilities.isFlying) {
player.motionX *= 0.5;
player.motionZ *= 0.5;
}
boolean omniMode = false;
if (EMT.isBootsActive) {
omniMode = isOmniEnabled(itemStack);
if ((player.moveForward == 0F && player.moveStrafing == 0F && omniMode)
|| (player.moveForward <= 0F && !omniMode)) {
return;
}
}
if (player.moveForward != 0.0F || player.moveStrafing != 0.0F) {
if (player.worldObj.isRemote && !player.isSneaking()) {
if (!Thaumcraft.instance.entityEventHandler.prevStep.containsKey(player.getEntityId())) {
Expand All @@ -145,7 +159,7 @@ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
bonus *= speedMod;
if (EMT.isBootsActive) {
applyOmniState(player, bonus, itemStack);
} else {
} else if (player.moveForward > 0.0) {
player.moveFlying(0.0F, player.moveForward, bonus);
}
} else if (Hover.getHover(player.getEntityId())) {
Expand All @@ -166,11 +180,12 @@ 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) {
if (player.moveForward != 0.0) {
player.moveFlying(0.0F, player.moveForward, bonus);
}
if (player.moveStrafing != 0.0 && getOmniState(itemStack)) {
player.moveFlying(player.moveStrafing, 0.0F, bonus);
}
}

@SubscribeEvent
Expand Down Expand Up @@ -311,4 +326,19 @@ public double getJumpModifier(ItemStack stack) {
}
return 1.0;
}

public boolean getOmniState(ItemStack stack) {
if (stack.stackTagCompound != null) {
return stack.stackTagCompound.getBoolean("omni");
}
return false;
}

public boolean getIntertialState(ItemStack stack) {
if (stack.stackTagCompound != null) {
return stack.stackTagCompound.getBoolean("inertiacanceling");
}
return false;
}

}

0 comments on commit 93f048f

Please sign in to comment.