Class ItemUtil
java.lang.Object
my.celium.org.util.ItemUtil
Small cohesive item-stack helpers.
-
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.world.item.ItemStackcopyWithCount(net.minecraft.world.item.ItemStack stack, int count) static intcount(net.minecraft.world.item.ItemStack stack) static voiddamage(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.ComponentdisplayName(net.minecraft.world.item.ItemStack stack) Custom name when present, otherwise the default item name.static booleanisEmpty(net.minecraft.world.item.ItemStack stack) static booleanmatches(net.minecraft.world.item.ItemStack a, net.minecraft.world.item.ItemStack b) Same item including components (enchantments, names, ...).static booleanmatchesItem(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.Item item)
-
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.
-