diff --git a/src/main/java/fox/spiteful/avaritia/items/ItemArmorInfinity.java b/src/main/java/fox/spiteful/avaritia/items/ItemArmorInfinity.java index dd92574..3da8d1e 100644 --- a/src/main/java/fox/spiteful/avaritia/items/ItemArmorInfinity.java +++ b/src/main/java/fox/spiteful/avaritia/items/ItemArmorInfinity.java @@ -2,7 +2,9 @@ package fox.spiteful.avaritia.items; import java.util.ArrayList; import java.util.Collection; +import java.util.HashSet; import java.util.List; +import java.util.Set; import net.minecraft.block.material.Material; import net.minecraft.client.model.ModelBiped; @@ -239,10 +241,10 @@ public class ItemArmorInfinity extends ItemArmor implements ICosmicRenderItem, I public static class abilityHandler { - public static List playersWithHat = new ArrayList(); - public static List playersWithChest = new ArrayList(); - public static List playersWithLeg = new ArrayList(); - public static List playersWithFoot = new ArrayList(); + public static Set playersWithHat = new HashSet<>(); + public static Set playersWithChest = new HashSet<>(); + public static Set playersWithLeg = new HashSet<>(); + public static Set playersWithFoot = new HashSet<>(); public static boolean playerHasHat(EntityPlayer player) { ItemStack armour = player.getCurrentArmor(3); @@ -270,12 +272,11 @@ public class ItemArmorInfinity extends ItemArmor implements ICosmicRenderItem, I @SubscribeEvent public void updatePlayerAbilityStatus(LivingUpdateEvent event) { - if (event.entityLiving instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) event.entityLiving; + if (event.entityLiving instanceof EntityPlayer player) { String key = playerKey(player); // hat - Boolean hasHat = playerHasHat(player); + boolean hasHat = playerHasHat(player); if (playersWithHat.contains(key)) { if (hasHat) { @@ -287,7 +288,7 @@ public class ItemArmorInfinity extends ItemArmor implements ICosmicRenderItem, I } // chest - Boolean hasChest = playerHasChest(player); + boolean hasChest = playerHasChest(player); if (playersWithChest.contains(key)) { if (hasChest) { player.capabilities.allowFlying = true; @@ -303,7 +304,7 @@ public class ItemArmorInfinity extends ItemArmor implements ICosmicRenderItem, I } // legs - Boolean hasLeg = playerHasLeg(player); + boolean hasLeg = playerHasLeg(player); if (playersWithLeg.contains(key)) { if (hasLeg) { @@ -315,14 +316,14 @@ public class ItemArmorInfinity extends ItemArmor implements ICosmicRenderItem, I } // shoes - Boolean hasFoot = playerHasFoot(player) && Config.fast; + boolean hasFoot = playerHasFoot(player) && Config.fast; if (playersWithFoot.contains(key)) { if (hasFoot) { boolean flying = player.capabilities.isFlying; boolean swimming = player.isInsideOfMaterial(Material.water) || player.isInWater(); if (player.onGround || flying || swimming) { boolean sneaking = player.isSneaking(); - player.stepHeight = sneaking ? 0.5f : 1.0f; + player.stepHeight = sneaking ? 0.501f : 1.001f; float speed = 0.15f * (flying ? 1.1f : 1.0f) * (sneaking ? 0.1f : 1.0f); @@ -348,6 +349,7 @@ public class ItemArmorInfinity extends ItemArmor implements ICosmicRenderItem, I } } else { playersWithFoot.remove(key); + player.stepHeight = 0.5f; } } else if (hasFoot) { playersWithFoot.add(key); @@ -357,8 +359,7 @@ public class ItemArmorInfinity extends ItemArmor implements ICosmicRenderItem, I @SubscribeEvent public void jumpBoost(LivingJumpEvent event) { - if (event.entityLiving instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) event.entityLiving; + if (event.entityLiving instanceof EntityPlayer player) { String key = playerKey(player); if (playersWithFoot.contains(key)) {