Package net.xun.lib.common.api.util
Class ArmorSlotsUtils
java.lang.Object
net.xun.lib.common.api.util.ArmorSlotsUtils
Provides specialized utilities for managing and inspecting player armor equipment.
Utilities for armor slots with features including:
- Armor presence and completeness checks
- Material type verification and set validation
- Enchantment analysis and level summation
- Durability monitoring and repair needs detection
- Slot-specific operations and armor retrieval
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic intcountArmorPiecesOfMaterial(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material) static intcountDamagedPieces(net.minecraft.world.entity.player.Player player) static Collection<net.minecraft.world.item.ItemStack> getAllWornArmor(net.minecraft.world.entity.player.Player player) static floatgetArmorDurabilityPercentage(int slotIndex, net.minecraft.world.entity.player.Player player) static net.minecraft.world.item.ItemStackgetArmorInSlot(net.minecraft.world.entity.player.Player player, int slotIndex) static intgetTotalEnchantmentLevel(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment> enchantment) static booleanhasArmorInSlot(net.minecraft.world.entity.player.Player player, int slotIndex) Checks if a specific armor slot contains any armor item.static booleanhasEnchantmentInSlot(net.minecraft.world.entity.player.Player player, int slotIndex, net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment> enchantment) static booleanhasFullArmorSet(net.minecraft.world.entity.player.Player player) static booleanhasFullArmorSetOfMaterial(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material) static booleanhasSetBonus(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material, int requiredPieces) static booleanisArmorDamaged(int slotIndex, net.minecraft.world.entity.player.Player player) static booleanisArmorMaterialInSlot(net.minecraft.world.entity.player.Player player, int slotIndex, net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material) Checks if armor in a specific slot matches given material.static booleanmatchesAllArmor(net.minecraft.world.entity.player.Player player, InventoryPredicate condition) static booleanmatchesInSlot(net.minecraft.world.entity.player.Player player, int slotIndex, InventoryPredicate condition) static booleanneedsRepair(int slotIndex, net.minecraft.world.entity.player.Player player)
-
Method Details
-
hasArmorInSlot
public static boolean hasArmorInSlot(net.minecraft.world.entity.player.Player player, int slotIndex) Checks if a specific armor slot contains any armor item.- Parameters:
player- The target playerslotIndex- Armor slot to check (seeSlotGetter)- Returns:
- True if the slot contains non-air armor, false otherwise
- Throws:
NullPointerException- if player is null
-
hasFullArmorSet
public static boolean hasFullArmorSet(net.minecraft.world.entity.player.Player player) -
isArmorMaterialInSlot
public static boolean isArmorMaterialInSlot(net.minecraft.world.entity.player.Player player, int slotIndex, net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material) Checks if armor in a specific slot matches given material.- Parameters:
player- The target playerslotIndex- Armor slot to check (seeSlotGetter)material- Required armor material- Returns:
- True if slot contains armor of specified material, false otherwise
- Throws:
NullPointerException- if any parameter is null
-
hasFullArmorSetOfMaterial
public static boolean hasFullArmorSetOfMaterial(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material) -
hasEnchantmentInSlot
public static boolean hasEnchantmentInSlot(net.minecraft.world.entity.player.Player player, int slotIndex, net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment> enchantment) -
getTotalEnchantmentLevel
public static int getTotalEnchantmentLevel(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment> enchantment) -
getArmorDurabilityPercentage
public static float getArmorDurabilityPercentage(int slotIndex, net.minecraft.world.entity.player.Player player) -
isArmorDamaged
public static boolean isArmorDamaged(int slotIndex, net.minecraft.world.entity.player.Player player) -
matchesInSlot
public static boolean matchesInSlot(net.minecraft.world.entity.player.Player player, int slotIndex, InventoryPredicate condition) -
matchesAllArmor
public static boolean matchesAllArmor(net.minecraft.world.entity.player.Player player, InventoryPredicate condition) -
getArmorInSlot
public static net.minecraft.world.item.ItemStack getArmorInSlot(net.minecraft.world.entity.player.Player player, int slotIndex) -
getAllWornArmor
public static Collection<net.minecraft.world.item.ItemStack> getAllWornArmor(net.minecraft.world.entity.player.Player player) -
countArmorPiecesOfMaterial
public static int countArmorPiecesOfMaterial(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material) -
hasSetBonus
public static boolean hasSetBonus(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material, int requiredPieces) -
needsRepair
public static boolean needsRepair(int slotIndex, net.minecraft.world.entity.player.Player player) -
countDamagedPieces
public static int countDamagedPieces(net.minecraft.world.entity.player.Player player)
-