Skip to content

Commit

Permalink
fix jetpack not deactivating in certain conditions, fly speed interfe…
Browse files Browse the repository at this point in the history
…rence
  • Loading branch information
zmaster587 committed Apr 10, 2018
1 parent 4422983 commit d5bf9e7
Showing 1 changed file with 9 additions and 9 deletions.
Expand Up @@ -93,14 +93,10 @@ else if(stack.getItemDamage() == 1)
MODES mode = getMode(componentStack);
boolean isActive = isActive(componentStack, player);

try {
flySpeed.setFloat(player.capabilities, speedUpgrades*0.02f);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
//ObfuscationReflectionHelper.setPrivateValue(net.minecraft.entity.player.PlayerCapabilities.class, player.capabilities, speedUpgrades*0.02f, "flySpeed");

//Apply speed upgrades
player.motionX *= 1 + speedUpgrades*0.02f;
player.motionZ *= 1 + speedUpgrades*0.02f;

if(hasModeSwitched(componentStack))
player.capabilities.isFlying = false;
Expand All @@ -112,13 +108,15 @@ else if(stack.getItemDamage() == 1)

if((isActive || player.isSneaking()) && !player.onGround)
setHeight(componentStack, (int)player.posY + player.height);

onAccelerate(componentStack, inv, player);
}
else if(isActive) {
onAccelerate(componentStack, inv, player);
}
}
else if(mode == MODES.HOVER)
if(!isActive)
player.capabilities.isFlying = false;
}


Expand Down Expand Up @@ -214,6 +212,8 @@ public void onAccelerate(ItemStack stack, IInventory inv, EntityPlayer player) {
player.fallDistance = 0;
}
}
else if(mode == MODES.HOVER)
player.capabilities.isFlying = false;

}

Expand Down

0 comments on commit d5bf9e7

Please sign in to comment.