From 2603692755bbfca6434e0ac003f1b94bf327dc40 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 30 Jul 2024 09:20:16 +0200 Subject: [PATCH] Fix AutoArmor trying to equip horse/wolf armor --- src/main/java/net/wurstclient/hacks/AutoArmorHack.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoArmorHack.java b/src/main/java/net/wurstclient/hacks/AutoArmorHack.java index 964b04f3..8cc5edb1 100644 --- a/src/main/java/net/wurstclient/hacks/AutoArmorHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoArmorHack.java @@ -19,6 +19,7 @@ import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.Enchantments; import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.item.AnimalArmorItem; import net.minecraft.item.ArmorItem; import net.minecraft.item.ArmorItem.Type; import net.minecraft.item.ItemStack; @@ -114,10 +115,10 @@ public final class AutoArmorHack extends Hack bestArmorSlots[type] = -1; ItemStack stack = inventory.getArmorStack(type); - if(stack.isEmpty() || !(stack.getItem() instanceof ArmorItem)) + if(!(stack.getItem() instanceof ArmorItem item) + || item instanceof AnimalArmorItem) continue; - ArmorItem item = (ArmorItem)stack.getItem(); bestArmorValues[type] = getArmorValue(item, stack); } @@ -126,10 +127,10 @@ public final class AutoArmorHack extends Hack { ItemStack stack = inventory.getStack(slot); - if(stack.isEmpty() || !(stack.getItem() instanceof ArmorItem)) + if(!(stack.getItem() instanceof ArmorItem item) + || item instanceof AnimalArmorItem) continue; - ArmorItem item = (ArmorItem)stack.getItem(); int armorType = item.getSlotType().getEntitySlotId(); int armorValue = getArmorValue(item, stack);