mirror of
https://github.com/GTNewHorizons/Electro-Magic-Tools.git
synced 2026-11-18 19:29:29 +00:00
Flybug + inertial canceling (#78)
This commit is contained in:
1 parent
b4f208eca7
commit
9f6aac9db0
2 files changed
+36
-6
No files matched your search
@@ -125,6 +125,20 @@ public class ItemElectricBootsTraveller extends ItemArmor
|
||||
|
||||
@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())) {
|
||||
@@ -145,7 +159,7 @@ public class ItemElectricBootsTraveller extends ItemArmor
|
||||
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())) {
|
||||
@@ -166,11 +180,12 @@ public class ItemElectricBootsTraveller extends ItemArmor
|
||||
|
||||
@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
|
||||
@@ -311,4 +326,19 @@ public class ItemElectricBootsTraveller extends ItemArmor
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user