Class ItemSpec.Builder
java.lang.Object
com.ultikits.ultitools.item.ItemSpec.Builder
- Enclosing class:
ItemSpec
A non-thread-safe builder; repeated builds produce independent immutable descriptions.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate @Nullable Booleanprivate final Map<org.bukkit.NamespacedKey, io.papermc.paper.datacomponent.DataComponentType> private final net.kyori.adventure.key.Keyprivate final Map<org.bukkit.NamespacedKey, ItemMarker<?, ?>> private @Nullable net.kyori.adventure.key.Keyprivate @Nullable Textprivate boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddLore(MessageKey key, Arg... args) Appends a translated lore line with uniquely named arguments.Appends a deferred lore line.amount(int amount) Sets the amount.build()Returns an independent description with all current builder attributes.data(io.papermc.paper.datacomponent.DataComponentType.NonValued type) Appends a flag component.<T> ItemSpec.Builderdata(io.papermc.paper.datacomponent.DataComponentType.Valued<T> type, T value) Appends a component value, applied unchanged and without localization.Sets the glint override, or clears it with null.hiddenInTooltip(Set<? extends io.papermc.paper.datacomponent.DataComponentType> types) Replaces the set of components whose tooltip lines are hidden, for exampleDataComponentTypes.ATTRIBUTE_MODIFIERSto hide "+7 Attack Damage".Replaces lore with a defensive copy of the lines.<P,C> ItemSpec.Builder marker(org.bukkit.NamespacedKey key, org.bukkit.persistence.PersistentDataType<P, C> type, C value) Adds a marker, replacing a previous marker with the same key in its original position.model(@Nullable net.kyori.adventure.key.Key model) Sets ITEM_MODEL, or clears the override with null.Sets the deferred name, or clears it with null.name(MessageKey key, Arg... args) Sets a translated name with uniquely named arguments.remove(io.papermc.paper.datacomponent.DataComponentType type) Removes a prototype component.tooltipHidden(boolean hidden) Sets whether the whole tooltip is hidden.private static voidvalidatePassThrough(io.papermc.paper.datacomponent.DataComponentType type)
-
Field Details
-
itemType
private final net.kyori.adventure.key.Key itemType -
amount
private int amount -
name
-
lore
-
model
@Nullable private @Nullable net.kyori.adventure.key.Key model -
glint
-
tooltipHidden
private boolean tooltipHidden -
patches
-
markers
-
-
Constructor Details
-
Builder
private Builder(net.kyori.adventure.key.Key itemType)
-
-
Method Details
-
amount
Sets the amount. @throws IllegalArgumentException outside 1..99 -
name
Sets the deferred name, or clears it with null. -
name
Sets a translated name with uniquely named arguments. -
lore
Replaces lore with a defensive copy of the lines. -
addLore
Appends a deferred lore line. -
addLore
Appends a translated lore line with uniquely named arguments. -
model
Sets ITEM_MODEL, or clears the override with null. -
glint
Sets the glint override, or clears it with null. -
tooltipHidden
Sets whether the whole tooltip is hidden. -
data
public <T> ItemSpec.Builder data(io.papermc.paper.datacomponent.DataComponentType.Valued<T> type, T value) Appends a component value, applied unchanged and without localization. The value must be immutable with value equals; Paper's own component values are.- Throws:
IllegalArgumentException- for any of the five typed component keys
-
data
Appends a flag component.- Throws:
IllegalArgumentException- for any of the five typed component keys
-
remove
Removes a prototype component.- Throws:
IllegalArgumentException- for any of the five typed component keys
-
marker
public <P,C> ItemSpec.Builder marker(org.bukkit.NamespacedKey key, org.bukkit.persistence.PersistentDataType<P, C> type, C value) Adds a marker, replacing a previous marker with the same key in its original position. The value must be immutable with value equals; Paper's own component values are. -
build
Returns an independent description with all current builder attributes. -
validatePassThrough
private static void validatePassThrough(io.papermc.paper.datacomponent.DataComponentType type)
-