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(net.minecraft.world.entity.player.Player player, int slotIndex) Get the remaining armor durability as percentagestatic net.minecraft.world.item.ItemStackgetArmorInSlot(net.minecraft.world.entity.player.Player player, int slotIndex) Get the armor in the specific slotstatic 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) Checks if the armor in the specific slot has any enchantmentsstatic booleanhasFullArmorSet(net.minecraft.world.entity.player.Player player) Checks if the player has armor in all armor slotsstatic booleanhasFullArmorSetOfMaterial(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material) Checks if the player is wearing armor in all armor slots and if all the armors matches the specific materialstatic booleanhasSetBonus(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material, int requiredPieces) 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) Checks if all armor slots contains an armor that matches the conditionstatic booleanmatchesInSlot(net.minecraft.world.entity.player.Player player, int slotIndex, InventoryPredicate condition) Checks if the slot contains an armor that matches the conditionstatic 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- Target playerslotIndex- Armor slot to check (seeSlotGetter)- Returns:
Trueif 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) Checks if the player has armor in all armor slots- Parameters:
player- Target player- Returns:
Trueif the player is wearing armor in all armor slots- Throws:
NullPointerException- if player is null
-
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- Target playerslotIndex- Armor slot to check (seeSlotGetter)material- Required armor material- Returns:
Trueif 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) Checks if the player is wearing armor in all armor slots and if all the armors matches the specific material- Parameters:
player- Target playermaterial- The material to check- Returns:
Trueif the player is wearing armor in all armor slots and all the armors matches the material
-
hasEnchantmentInSlot
public static boolean hasEnchantmentInSlot(net.minecraft.world.entity.player.Player player, int slotIndex) Checks if the armor in the specific slot has any enchantments- Parameters:
player- Target playerslotIndex- The slot index- Returns:
Trueif the armor in the slot has enchantments
-
getArmorDurabilityPercentage
public static float getArmorDurabilityPercentage(net.minecraft.world.entity.player.Player player, int slotIndex) Get the remaining armor durability as percentage- Parameters:
player- Target playerslotIndex- The slot index- Returns:
- The remaining durability as percentage
-
matchesInSlot
public static boolean matchesInSlot(net.minecraft.world.entity.player.Player player, int slotIndex, InventoryPredicate condition) Checks if the slot contains an armor that matches the condition- Parameters:
player- Target playerslotIndex- The slot indexcondition- The condition- Returns:
Trueif the armor in the specific slot matches the condition
-
matchesAllArmor
public static boolean matchesAllArmor(net.minecraft.world.entity.player.Player player, InventoryPredicate condition) Checks if all armor slots contains an armor that matches the condition- Parameters:
player- Target playercondition- The condition- Returns:
Trueif the item in the specific slot matches the condition
-
getArmorInSlot
public static net.minecraft.world.item.ItemStack getArmorInSlot(net.minecraft.world.entity.player.Player player, int slotIndex) Get the armor in the specific slot- Parameters:
player- Target playerslotIndex- The slot index- Returns:
- The armor in the specific slot
-
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)
-