Class ItemUtil

java.lang.Object
my.celium.org.util.ItemUtil

public final class ItemUtil extends Object
Small cohesive item-stack helpers.
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.world.item.ItemStack
    copyWithCount(net.minecraft.world.item.ItemStack stack, int count)
     
    static int
    count(net.minecraft.world.item.ItemStack stack)
     
    static void
    damage(net.minecraft.server.level.ServerLevel level, net.minecraft.world.item.ItemStack stack, net.minecraft.server.level.ServerPlayer player, int amount)
    Damages a stack on the server (armour, tools, ...).
    static net.minecraft.network.chat.Component
    displayName(net.minecraft.world.item.ItemStack stack)
    Custom name when present, otherwise the default item name.
    static boolean
    isEmpty(net.minecraft.world.item.ItemStack stack)
     
    static boolean
    matches(net.minecraft.world.item.ItemStack a, net.minecraft.world.item.ItemStack b)
    Same item including components (enchantments, names, ...).
    static boolean
    matchesItem(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.Item item)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isEmpty

      public static boolean isEmpty(net.minecraft.world.item.ItemStack stack)
    • count

      public static int count(net.minecraft.world.item.ItemStack stack)
    • matches

      public static boolean matches(net.minecraft.world.item.ItemStack a, net.minecraft.world.item.ItemStack b)
      Same item including components (enchantments, names, ...).
    • matchesItem

      public static boolean matchesItem(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.Item item)
    • copyWithCount

      public static net.minecraft.world.item.ItemStack copyWithCount(net.minecraft.world.item.ItemStack stack, int count)
    • displayName

      public static net.minecraft.network.chat.Component displayName(net.minecraft.world.item.ItemStack stack)
      Custom name when present, otherwise the default item name.
    • damage

      public static void damage(net.minecraft.server.level.ServerLevel level, net.minecraft.world.item.ItemStack stack, net.minecraft.server.level.ServerPlayer player, int amount)
      Damages a stack on the server (armour, tools, ...). No-op for empty or undamageable stacks.