Class ItemSpec
java.lang.Object
com.ultikits.ultitools.item.ItemSpec
Deeply immutable and thread-safe provided pass-through values are immutable
(see
ItemSpec.Builder.data(DataComponentType.Valued, Object)); equals/hashCode compare every attribute,
including marker values by content, and the GUI diff relies on it.
An ItemRenderer renders its name and lore once the viewer's locale is known; Paper does not
translate item text per client.
Building from a Key with amount, text, model, glint, tooltip flags and markers needs no running server; builder(Material) and any DataComponentType argument need Paper's registries (a server or MockBukkit).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA non-thread-safe builder; repeated builds produce independent immutable descriptions. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intprivate final @Nullable Booleanprivate final Set<io.papermc.paper.datacomponent.DataComponentType> private final Set<org.bukkit.NamespacedKey> private final net.kyori.adventure.key.Keyprivate final List<ItemMarker<?, ?>> private final @Nullable net.kyori.adventure.key.Keyprivate final @Nullable Textprivate final boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintamount()Returns the amount, in 1..99.static ItemSpec.Builderbuilder(net.kyori.adventure.key.Key itemType) Returns a builder for the item key, initially with amount 1.static ItemSpec.Builderbuilder(org.bukkit.Material material) Shorthand forbuilder(material.getKey()).booleanCompares all attributes, including the order of patches and markers.@Nullable Booleanglint()Returns ENCHANTMENT_GLINT_OVERRIDE, or absent for the item's default.inthashCode()Returns a hash of every attribute.Set<io.papermc.paper.datacomponent.DataComponentType> Components whose tooltip lines are hidden (TOOLTIP_DISPLAYhiddenComponents); unmodifiable, may be empty.net.kyori.adventure.key.KeyitemType()Returns the registry key of the item to create.lore()Returns unmodifiable lore; empty means no LORE component is set.List<ItemMarker<?, ?>> markers()Returns unmodifiable persistent-data markers in insertion order.@Nullable net.kyori.adventure.key.Keymodel()Returns ITEM_MODEL, or absent.@Nullable Textname()Returns text for ITEM_NAME (the non-italic default name), or absent.patches()Returns unmodifiable pass-through changes in insertion order.Returns a builder initialized with every attribute of this description.booleanReturns whether TOOLTIP_DISPLAY hides the entire tooltip.toString()Returns every attribute for diagnostics.
-
Field Details
-
TYPED_COMPONENTS
-
itemType
private final net.kyori.adventure.key.Key itemType -
amount
private final int amount -
name
-
lore
-
model
@Nullable private final @Nullable net.kyori.adventure.key.Key model -
glint
-
tooltipHidden
private final boolean tooltipHidden -
patches
-
markers
-
-
Constructor Details
-
ItemSpec
-
-
Method Details
-
builder
Returns a builder for the item key, initially with amount 1.- Throws:
IllegalArgumentException- forminecraft:air
-
builder
Shorthand forbuilder(material.getKey()).- Throws:
IllegalArgumentException- if the material is AIR or is not an item
-
itemType
public net.kyori.adventure.key.Key itemType()Returns the registry key of the item to create. -
amount
public int amount()Returns the amount, in 1..99. -
name
Returns text for ITEM_NAME (the non-italic default name), or absent. -
lore
-
model
@Nullable public @Nullable net.kyori.adventure.key.Key model()Returns ITEM_MODEL, or absent. -
glint
Returns ENCHANTMENT_GLINT_OVERRIDE, or absent for the item's default. -
tooltipHidden
public boolean tooltipHidden()Returns whether TOOLTIP_DISPLAY hides the entire tooltip. -
patches
-
markers
Returns unmodifiable persistent-data markers in insertion order. -
toBuilder
Returns a builder initialized with every attribute of this description. -
equals
-
hashCode
-
toString
-