Skip to content
NotCoded edited this page Sep 14, 2023 · 2 revisions

Item

BlockUtil

ItemDisplayUtil

ItemStackUtil


BlockUtil


blockToText(BlockState blockState)

Gets the block name, e.g. iron_block.

  • Returns: The name of the block.

blockToText(Block block)

Gets the block name, e.g. iron_block.

  • Returns: The name of the block.

ItemDisplayUtil


addLore(ItemStack itemStack, String string, int line)

Adds the lore to an item.


removeLore(ItemStack itemStack, int line)

Removes lore from an item.


addGlint(ItemStack itemStack)

Adds enchantment glint to an item.


ItemStackUtil


hasRoomFor(Inventory inventory, ItemStack itemStack)

Checks if the inventory has enough room to store an item.

  • Returns: If the inventory has room for the item.

hasItem(Inventory inventory, Item item)

Checks if the inventory has an item.

  • Returns: If the inventory has the item.

isSameItem(ItemStack itemStack1, ItemStack2)

Checks if the inventory has the same item.

  • Returns: If the inventory has the same item.

stringToItemStack(String string)

Turns a string into an ItemStack, e.g. diamond_sword.

  • Returns: The ItemStack

itemStackToString(ItemStack, boolean reversible)

Turns a ItemStack into a string, e.g. diamond_sword.

  • Returns: The String

getInvItems(ServerPlayer player)

Gets all the ItemStacks in the player's inventory.

  • Returns: ItemStacks in an ArrayList.

itemFromString(String name)

Tries to get the item from the string, e.g. diamond_sword.

  • Returns: The Item

enchant(ItemStack itemStack, Enchantment enchantment, int level)

Enchants an ItemStack with an enchantment and level.


getContainerClickItem(ServerPlayer player, ServerboundContainerClickPacket packet)

Gets the ItemStack in the container click.

  • Returns: The ItemStack.

Clone this wiki locally