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(net.minecraft.world.entity.player.Player player, int slotIndex)
    Get the remaining armor durability as percentage
    static net.minecraft.world.item.ItemStack
    getArmorInSlot(net.minecraft.world.entity.player.Player player, int slotIndex)
    Get the armor in the specific slot
    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)
    Checks if the armor in the specific slot has any enchantments
    static boolean
    hasFullArmorSet(net.minecraft.world.entity.player.Player player)
    Checks if the player has armor in all armor slots
    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
    static boolean
    hasSetBonus(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material, int requiredPieces)
     
    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)
    Checks if all armor slots contains an armor that matches the condition
    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
    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 - 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)
      Checks if the player has armor in all armor slots
      Parameters:
      player - Target player
      Returns:
      True if 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 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)
      Checks if the player is wearing armor in all armor slots and if all the armors matches the specific material
      Parameters:
      player - Target player
      material - The material to check
      Returns:
      True if 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 player
      slotIndex - The slot index
      Returns:
      True if 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 player
      slotIndex - 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 player
      slotIndex - The slot index
      condition - The condition
      Returns:
      True if 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 player
      condition - The condition
      Returns:
      True if 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 player
      slotIndex - 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)