0
0
mirror of https://github.com/Wurst-Imperium/Wurst7.git synced 2024-09-19 17:02:13 +02:00

Fix AutoArmor trying to equip horse/wolf armor

This commit is contained in:
Alexander01998 2024-07-30 09:20:16 +02:00
parent fad99db20b
commit 2603692755

View File

@ -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);