Made boots work when power is disabled.

This commit is contained in:
Florian Nücke 2015-05-22 20:12:08 +02:00
parent ce0ec1dc54
commit e647e37243

View File

@ -17,13 +17,15 @@ object HoverBootsHandler {
val hadHoverBoots = nbt.getBoolean(Settings.namespace + "hasHoverBoots")
val hasHoverBoots = !player.isSneaking && equippedArmor(player).exists(stack => stack.getItem match {
case boots: HoverBoots =>
if (player.onGround && !player.capabilities.isCreativeMode && player.worldObj.getTotalWorldTime % 20 == 0) {
val velocity = player.motionX * player.motionX + player.motionY * player.motionY + player.motionZ * player.motionZ
if (velocity > 0.015f) {
boots.charge(stack, -Settings.get.hoverBootMove, simulate = false)
Settings.get.ignorePower || {
if (player.onGround && !player.capabilities.isCreativeMode && player.worldObj.getTotalWorldTime % 20 == 0) {
val velocity = player.motionX * player.motionX + player.motionY * player.motionY + player.motionZ * player.motionZ
if (velocity > 0.015f) {
boots.charge(stack, -Settings.get.hoverBootMove, simulate = false)
}
}
boots.getCharge(stack) > 0
}
boots.getCharge(stack) > 0
case _ => false
})
if (hasHoverBoots != hadHoverBoots) {
@ -43,7 +45,7 @@ object HoverBootsHandler {
case stack if stack.getItem.isInstanceOf[HoverBoots] =>
val boots = stack.getItem.asInstanceOf[HoverBoots]
val hoverJumpCost = -Settings.get.hoverBootJump
val isCreative = player.capabilities.isCreativeMode
val isCreative = Settings.get.ignorePower || player.capabilities.isCreativeMode
if (isCreative || boots.charge(stack, hoverJumpCost, simulate = true) == 0) {
if (!isCreative) boots.charge(stack, hoverJumpCost, simulate = false)
if (player.isSprinting)
@ -62,7 +64,7 @@ object HoverBootsHandler {
case stack if stack.getItem.isInstanceOf[HoverBoots] =>
val boots = stack.getItem.asInstanceOf[HoverBoots]
val hoverFallCost = -Settings.get.hoverBootAbsorb
val isCreative = player.capabilities.isCreativeMode
val isCreative = Settings.get.ignorePower || player.capabilities.isCreativeMode
if (isCreative || boots.charge(stack, hoverFallCost, simulate = true) == 0) {
if (!isCreative) boots.charge(stack, hoverFallCost, simulate = false)
e.distance *= 0.3f