Class ArmorSlotsUtils

java.lang.Object
net.xun.lib.common.api.util.ArmorSlotsUtils

public class ArmorSlotsUtils extends Object
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 Type
    Method
    Description
    static int
    countArmorPiecesOfMaterial(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material)
     
    static int
    countDamagedPieces(net.minecraft.world.entity.player.Player player)
     
    static Collection<net.minecraft.world.item.ItemStack>
    getAllWornArmor(net.minecraft.world.entity.player.Player player)
     
    static float
    getArmorDurabilityPercentage(int slotIndex, net.minecraft.world.entity.player.Player player)
     
    static net.minecraft.world.item.ItemStack
    getArmorInSlot(net.minecraft.world.entity.player.Player player, int slotIndex)
     
    static int
    getTotalEnchantmentLevel(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment> enchantment)
     
    static boolean
    hasArmorInSlot(net.minecraft.world.entity.player.Player player, int slotIndex)
    Checks if a specific armor slot contains any armor item.
    static boolean
    hasEnchantmentInSlot(net.minecraft.world.entity.player.Player player, int slotIndex, net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment> enchantment)
     
    static boolean
    hasFullArmorSet(net.minecraft.world.entity.player.Player player)
     
    static boolean
    hasFullArmorSetOfMaterial(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material)
     
    static boolean
    hasSetBonus(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material, int requiredPieces)
     
    static boolean
    isArmorDamaged(int slotIndex, net.minecraft.world.entity.player.Player player)
     
    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.
    static boolean
    matchesAllArmor(net.minecraft.world.entity.player.Player player, InventoryPredicate condition)
     
    static boolean
    matchesInSlot(net.minecraft.world.entity.player.Player player, int slotIndex, InventoryPredicate condition)
     
    static boolean
    needsRepair(int slotIndex, net.minecraft.world.entity.player.Player player)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 player
      slotIndex - Armor slot to check (see SlotGetter)
      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 player
      slotIndex - Armor slot to check (see SlotGetter)
      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)