ItemBuilder

class ItemBuilder(material: Material)

A builder class for creating and customizing ItemStack objects in a flexible manner. Allows setting properties like display name, lore, enchantments, flags, and more.

Parameters

material

The material of the item being built.

Constructors

Link copied to clipboard
constructor(material: Material)

Functions

Link copied to clipboard
fun amount(amount: Int): ItemBuilder

Sets the amount (stack size) of the item.

Link copied to clipboard
fun build(): ItemStack

Builds and returns the final ItemStack with all applied modifications.

Link copied to clipboard

Sets a custom model data ID for the item.

Link copied to clipboard
fun enchant(enchantment: Enchantment, level: Int, ignoreLimit: Boolean = false): ItemBuilder

Adds an enchantment to the item.

Link copied to clipboard
fun flags(vararg flags: ItemFlag): ItemBuilder

Sets the flags for the item.

Link copied to clipboard

Adds a glow effect to the item.

Link copied to clipboard
fun lore(vararg lines: String): ItemBuilder

Sets the lore (description) of the item.

Link copied to clipboard
fun name(name: String): ItemBuilder

Sets the display name of the item.

Link copied to clipboard
fun unbreakable(flag: Boolean = true): ItemBuilder

Makes the item unbreakable.