Package net.tnemc.item
Interface AbstractItemStack<T>
- Type Parameters:
T
- The implementation-specific type of this item stack.
- All Superinterfaces:
Cloneable
- All Known Implementing Classes:
BukkitItemStack
,PaperItemStack
Represents a generic abstraction for an item stack with various attributes and properties.
This interface allows for chaining multiple properties and supports serialization.
- Author:
- creatorfromhell
-
Method Summary
Modifier and TypeMethodDescriptiondefault AbstractItemStack
<T> add
(int amount) Adds the specified amount to the current amount of this item stack.int
amount()
The quantity of the item stack.amount
(int amount) Sets the quantity of the item stack.default <C extends SerialComponent<? extends AbstractItemStack<T>,
T>>
AbstractItemStack<T> applyComponent
(C component) Applies a serialized component to the item stack.default AbstractItemStack
<T> applyPersistent
(PersistentDataType<?> data) Applies persistent data to the item stack.applyPersistentHolder
(PersistentDataHolder newHolder, boolean replaceOld) Replaces the persistent data holder for the item stack.default Optional
<AttributeModifiersComponent<AbstractItemStack<T>, T>> Retrieves the AttributeModifiersComponent of the item stack if present.attributeModifiers
(List<AttributeModifier> modifiers, boolean showInTooltip) Updates the attribute modifiers of the item stack.default Optional
<BannerPatternsComponent<AbstractItemStack<T>, T>> Retrieves the BannerPatternsComponent of the item stack if present.bannerPatterns
(List<PatternData> patterns) Updates the banner patterns of the item stack.default Optional
<BaseColorComponent<AbstractItemStack<T>, T>> Retrieves the BaseColorComponent of the item stack if present.Updates the base color of the item stack.default Optional
<BlocksAttacksComponent<AbstractItemStack<T>, T>> Retrieves the BlocksAttacksComponent associated with this method.blocksAttacks
(ItemDamage damage) Blocks attacks with the specified damage type using this item.default Optional
<BreakSoundComponent<AbstractItemStack<T>, T>> Retrieves the break sound component associated with the object.breakSound
(String sound) Set the break sound for this item stack.default Optional
<BucketEntityDataComponent<AbstractItemStack<T>, T>> Retrieves the BucketEntityDataComponent of the item stack if present.bucketEntityData
(boolean noAI, boolean silent, boolean noGravity, boolean glowing, boolean invulnerable, float health, int age, int variant, long huntingCooldown, int bucketVariantTag, String type) Updates the bucket entity data of the item stack.default Optional
<BundleComponent<AbstractItemStack<T>, T>> bundle()
Retrieves the bundle component from the components map.bundle
(Map<Integer, AbstractItemStack<T>> items) Bundles a collection ofAbstractItemStack
instances into a single collection.default Optional
<CanBreakComponent<AbstractItemStack<T>, T>> canBreak()
Retrieves the CanBreakComponent of the item stack if present.canBreak
(List<BlockPredicate> predicates) Updates the blocks that the item stack can break.default Optional
<CanPlaceOnComponent<AbstractItemStack<T>, T>> Retrieves the CanPlaceOnComponent of the item stack if present.canPlaceOn
(List<BlockPredicate> predicates) Updates the blocks that the item stack can be placed on.default <C extends SerialComponent<? extends AbstractItemStack<T>,
T>>
Optional<C> Retrieves a SerialComponent associated with the specified identifier.<C extends SerialComponent<? extends AbstractItemStack<T>,
T>>
Map<String, C> Retrieves the components applied to the item stack.default Optional
<ConsumableComponent<AbstractItemStack<T>, T>> Retrieves the ConsumableComponent of the item stack if present.consumable
(float consumeSeconds, String animation, String sound, boolean hasConsumeParticles, List<ComponentEffect> effects) Updates the consumable properties of the item stack.default Optional
<ContainerComponent<AbstractItemStack<T>, T>> Returns anOptional
containing theContainerComponent
with type parametersAbstractItemStack
and T stored in this container.container
(Map<Integer, AbstractItemStack<T>> items) Constructs a container with the given map of items.default Optional
<CustomNameComponent<AbstractItemStack<T>, T>> Retrieves the CustomNameComponent of the item stack if present.customName
(net.kyori.adventure.text.Component customName) Updates the custom name of the item stack.default Optional
<DamageComponent<AbstractItemStack<T>, T>> damage()
Retrieves the DamageComponent of the item stack if present.damage
(int damage) Updates the damage of the item stack.default Optional
<DamageResistantComponent<AbstractItemStack<T>, T>> Retrieves the DamageResistantComponent of the item stack if present.damageResistant
(List<String> types) Updates the damage-resistant types of the item stack.default Optional
<DeathProtectionComponent<AbstractItemStack<T>, T>> Retrieves the DeathProtectionComponent of the item stack if present.deathProtection
(List<ComponentEffect> deathEffects) Updates the death protection effects of the item stack.debug
(boolean debug) Enables or disables debug mode for the item stack.default Optional
<DyedColorComponent<AbstractItemStack<T>, T>> Retrieves the DyedColorComponent of the item stack if present.dyedColor
(int rgb) Updates the dyed color of the item stack.Adds an enchantment to the item stack.Adds enchantments to the item stack by name.Adds multiple enchantments to the item stack.default Optional
<EnchantableComponent<AbstractItemStack<T>, T>> Retrieves the EnchantableComponent of the item stack if present.enchantable
(int value) Updates the enchantability of the item stack.default Optional
<EnchantmentGlintOverrideComponent<AbstractItemStack<T>, T>> Retrieves the EnchantmentGlintOverrideComponent of the item stack if present.enchantmentGlintOverride
(boolean glintOverride) Updates the enchantment glint override of the item stack.default Optional
<EnchantmentsComponent<AbstractItemStack<T>, T>> Retrieves the EnchantmentsComponent of the item stack if present.enchantments
(Map<String, Integer> levels) Updates the enchantments of the item stack.default Optional
<EntityVariantComponent<AbstractItemStack<T>, T>> Retrieves the Entity Variant Component for the current stack.entityVariant
(String entity, String variant) Generates an AbstractItemStack based on the given entity and variant.default Optional
<EquipComponent<AbstractItemStack<T>, T>> equip()
Retrieves the EquipComponent of the item stack if present.equip
(String cameraKey, String equipSound, String modelKey, EquipSlot slot, boolean damageOnHurt, boolean dispensable, boolean swappable, boolean equipOnInteract, List<String> entities) Equips an item with specified parameters.default Optional
<FireworkExplosionComponent<AbstractItemStack<T>, T>> Retrieves the FireworkExplosionComponent of the item stack if present.fireworkExplosion
(ExplosionData explosion) Updates the firework explosion properties of the item stack.default Optional
<FireworksComponent<AbstractItemStack<T>, T>> Retrieves the FireworksComponent of the item stack if present.fireworks
(byte flightDuration, List<ExplosionData> explosions) Updates the fireworks properties of the item stack.flags()
Retrieves the item flags.Sets the item flags.default Optional
<FoodComponent<AbstractItemStack<T>, T>> food()
Retrieves the FoodComponent of the item stack if present.food
(boolean noHunger, float saturation, int nutrition) Updates the food properties of the item stack.default Optional
<GliderComponent<AbstractItemStack<T>, T>> glider()
Retrieves the GliderComponent of the item stack if present.Updates the item stack to enable glider functionality.default boolean
hasComponent
(String identifier) Checks if a component with the specified identifier is present.default Optional
<HideAdditionalTooltipComponent<AbstractItemStack<T>, T>> Retrieves the HideAdditionalTooltipComponent of the item stack if present.Updates the item stack to hide additional tooltip.default Optional
<HideTooltipComponent<AbstractItemStack<T>, T>> Retrieves the HideTooltipComponent of the item stack if present.Updates the item stack to hide its tooltip.default Optional
<InstrumentComponent<AbstractItemStack<T>, T>> Retrieves the InstrumentComponent of the item stack if present.instrument
(String soundEvent, int useDuration, int range) Updates the instrument properties of the item stack.default Optional
<IntangibleProjectileComponent<AbstractItemStack<T>, T>> Retrieves the IntangibleProjectileComponent of the item stack if present.Updates the item stack as an intangible projectile.boolean
isDirty()
Checks whether the object is dirty or has unsaved changes.default Optional
<ItemModelComponent<AbstractItemStack<T>, T>> Retrieves the ItemModelComponent of the item stack if present.Updates the model properties of the item stack.default Optional
<ItemNameComponent<AbstractItemStack<T>, T>> itemName()
Retrieves the ItemNameComponent of the item stack if present.itemName
(net.kyori.adventure.text.Component itemName) Updates the name of the item stack.This method returns a String representing the item provider.default Optional
<JukeBoxComponent<AbstractItemStack<T>, T>> jukebox()
Retrieves the JukeBoxComponent of the item stack if present.Updates the jukebox properties of the item stack.default Optional
<LodestoneTrackerComponent<AbstractItemStack<T>, T>> Retrieves the LodestoneTrackerComponent of the item stack if present.lodestoneTracker
(String target, int[] pos, String dimension, boolean tracked) Updates the lodestone tracker properties of the item stack.default Optional
<LoreComponent<AbstractItemStack<T>, T>> lore()
Retrieves the LoreComponent of the item stack if present.Updates the lore of the item stack.loreComponent
(List<net.kyori.adventure.text.Component> lore) Sets the lore (descriptive text) of the item stack.default Optional
<MapColorComponent<AbstractItemStack<T>, T>> mapColor()
Retrieves the MapColorComponent of the item stack if present.mapColor
(int mapColor) Updates the map color of the item stack.default Optional
<MapIDComponent<AbstractItemStack<T>, T>> mapId()
Retrieves the MapIDComponent of the item stack if present.mapId
(int mapId) Updates the map ID of the item stack.void
Marks the item stack as dirty, indicating changes have been made.material()
Returns the material of the item stack.Sets the material of the item stack.default Optional
<MaxDamageComponent<AbstractItemStack<T>, T>> Retrieves the MaxDamageComponent of the item stack if present.maxDamage
(int maxDamage) Updates the maximum damage of the item stack.default Optional
<MaxStackSizeComponent<AbstractItemStack<T>, T>> Retrieves the MaxStackSizeComponent of the item stack if present.maxStackSize
(int maxStackSize) Updates the maximum stack size of the item stack.default Optional
<ModelDataComponent<AbstractItemStack<T>, T>> Retrieves the ModelDataComponent of the item stack if present.Updates the model data of the item stack.default Optional
<ModelDataOldComponent<AbstractItemStack<T>, T>> Deprecated.modelDataOld
(int customModelData) Deprecated.Since MC 1.21.3 UseItemModelComponent
andModelDataComponent
.default Optional
<NoteBlockSoundComponent<AbstractItemStack<T>, T>> Retrieves the NoteBlockSoundComponent of the item stack if present.noteBlockSound
(String soundId) Updates the note block sound of the item stack.Creates a new item stack with the specified material and amount.of
(org.json.simple.JSONObject json) Creates a new item stack from a JSON representation.Creates a new item stack from a locale-specific object.default Optional
<OminousBottleAmplifierComponent<AbstractItemStack<T>, T>> Retrieves the OminousBottleAmplifierComponent of the item stack if present.ominousBottleAmplifier
(int amplifier) Updates the ominous bottle amplifier of the item stack.Retrieves the persistent data holder for the item stack.default Optional
<PotDecorationsComponent<AbstractItemStack<T>, T>> Retrieves the PotDecorationsComponent of the item stack if present.potDecorations
(List<String> decorations) Updates the pot decorations of the item stack.default Optional
<PotionContentsComponent<AbstractItemStack<T>, T>> Retrieves the PotionContentsComponent of the item stack if present.potionContents
(String potionId, int customColor, String customName, List<EffectInstance> effects) Updates the potion contents of the item stack.default Optional
<PotionDurationScaleComponent<AbstractItemStack<T>, T>> Retrieves the potion duration scale component from the item's components.potionDuration
(float potionDuration) Sets the duration of a potion effect for the item stack.default Optional
<ProfileComponent<AbstractItemStack<T>, T>> profile()
Retrieves the profile component from the components map if it exists.default AbstractItemStack
<T> Create a Profile based on the provided name and UUID.default AbstractItemStack
<T> Profiles the item stack with the given name, UUID, and texture.profile
(SkullProfile profile) Profiles the given SkullProfile to the AbstractItemStack object.provider()
This method is used to return an ItemProvider object.Retrieves the provider item ID associated with the current object.default Optional
<ProvidesBannerPatternsComponent<AbstractItemStack<T>, T>> Retrieves the component that provides banner patterns.providesPattern
(String patternTag) Retrieve an AbstractItemStack object that provides a specific pattern identified by the patternTag.default Optional
<ProvidesTrimMaterialComponent<AbstractItemStack<T>, T>> Retrieves the component responsible for providing trim materials.providesTrim
(String material) Applies the specified trim materialdefault Optional
<RarityComponent<AbstractItemStack<T>, T>> rarity()
Retrieves the RarityComponent of the item stack if present.Updates the rarity of the item stack.default Optional
<RecipesComponent<AbstractItemStack<T>, T>> recipes()
Retrieves the RecipesComponent of the item stack if present.Updates the recipes of the item stack.default Optional
<RepairableComponent<AbstractItemStack<T>, T>> Retrieves the RepairableComponent of the item stack if present.repairable
(List<String> repairItems) Updates the repairable items of the item stack.default Optional
<RepairCostComponent<AbstractItemStack<T>, T>> Retrieves the RepairCostComponent of the item stack if present.repairCost
(int repairCost) Updates the repair cost of the item stack.void
Resets the dirty flag, indicating that the object's state has been synchronized with the database.setItemProvider
(String itemProvider) Sets the item provider to be used for retrieving items.setProviderItemID
(String providerItemID) Sets the provider's item ID for the current item.int
slot()
Represents the inventory slot of the item stack.slot
(int slot) Sets the inventory slot of the item stack.default Optional
<StoredEnchantmentsComponent<AbstractItemStack<T>, T>> Retrieves the StoredEnchantmentsComponent of the item stack if present.storedEnchantments
(Map<String, Integer> enchantments) Updates the stored enchantments of the item stack.default AbstractItemStack
<T> subtract
(int amount) Subtracts the specified amount from the current item stack.default Optional
<SuspiciousStewEffectsComponent<AbstractItemStack<T>, T>> Retrieves the SuspiciousStewEffectsComponent of the item stack if present.suspiciousStewEffects
(List<EffectInstance> effects) Applies the given effects to the suspicious stew item.suspiciousStewEffects
(EffectInstance... effects) Applies the given effects to a suspicious stew item.org.json.simple.JSONObject
toJSON()
Converts the object to a JSONObject representation.default Optional
<ToolComponent<AbstractItemStack<T>, T>> tool()
Retrieves the ToolComponent of the item stack if present.Constructs a new tool item with the specified characteristics.default Optional
<TooltipDisplayComponent<AbstractItemStack<T>, T>> Retrieves the tooltip display component associated with the item.tooltipDisplay
(boolean hideTooltip, String... hiddenComponents) Displays tooltip for the item stack with an option to hide certain components.default Optional
<TooltipStyleComponent<AbstractItemStack<T>, T>> Retrieves the TooltipStyleComponent of the item stack if present.tooltipStyle
(String style) Updates the tooltip style of the item stack.default Optional
<TrimComponent<AbstractItemStack<T>, T>> trim()
Retrieves the TrimComponent of the item stack if present.Updates the trim properties of the item stack.default Optional
<UnbreakableComponent<AbstractItemStack<T>, T>> Retrieves the UnbreakableComponent of the item stack if present.unbreakable
(boolean showInTooltip) Updates the unbreakable property of the item stack.default Optional
<UseCooldownComponent<AbstractItemStack<T>, T>> Retrieves the UseCooldownComponent of the item stack if present.useCooldown
(String cooldownGroup, float seconds) Updates the use cooldown properties of the item stack.default Optional
<WeaponComponent<AbstractItemStack<T>, T>> weapon()
Retrieves the weapon component associated with this item.weapon
(int damagePerAttack, boolean canDisableBlocking) Represents a weapon item that can be used for combat.default Optional
<WritableBookContentComponent<AbstractItemStack<T>, T>> Retrieves the WritableBookContentComponent of the item stack if present.writableBookContent
(List<String> pages) Updates the writable book content of the item stack.default Optional
<WrittenBookContentComponent<AbstractItemStack<T>, T>> Retrieves the WrittenBookContentComponent of the item stack if present.writtenBookContent
(String title, String author, int generation, boolean resolved, List<String> pages) Updates the written book content of the item stack.
-
Method Details
-
of
Creates a new item stack with the specified material and amount.- Parameters:
material
- The material of the item.amount
- The number of items in the stack.- Returns:
- A new item stack instance.
- Since:
- 0.2.0.0
-
of
Creates a new item stack from a locale-specific object.- Parameters:
locale
- The locale-specific representation.- Returns:
- A new item stack instance.
- Since:
- 0.2.0.0
-
of
AbstractItemStack<T> of(org.json.simple.JSONObject json) throws org.json.simple.parser.ParseException Creates a new item stack from a JSON representation.- Parameters:
json
- The JSON object containing item stack data.- Returns:
- A new item stack instance.
- Throws:
org.json.simple.parser.ParseException
- If the JSON structure is invalid.- Since:
- 0.2.0.0
-
flags
Sets the item flags.- Parameters:
flags
- A list of flags to apply to the item.- Returns:
- The updated item stack instance.
- Since:
- 0.2.0.0
-
loreComponent
Sets the lore (descriptive text) of the item stack.- Parameters:
lore
- A list of components representing the lore.- Returns:
- The updated item stack instance.
- Since:
- 0.2.0.0
-
enchant
Adds an enchantment to the item stack.- Parameters:
enchantment
- The enchantment name.level
- The level of the enchantment.- Returns:
- The updated item stack instance.
- Since:
- 0.2.0.0
-
enchant
Adds multiple enchantments to the item stack.- Parameters:
enchantments
- A map of enchantment names and levels.- Returns:
- The updated item stack instance.
- Since:
- 0.2.0.0
-
enchant
Adds enchantments to the item stack by name.- Parameters:
enchantments
- A list of enchantment names.- Returns:
- The updated item stack instance.
- Since:
- 0.2.0.0
-
material
Returns the material of the item stack.- Returns:
- The material of the item stack.
- Since:
- 0.2.0.0
-
material
Sets the material of the item stack.- Parameters:
material
- The material name.- Returns:
- The updated item stack instance.
- Since:
- 0.2.0.0
-
amount
int amount()The quantity of the item stack.- Returns:
- the quantity of the item stack.
- Since:
- 0.2.0.0
-
amount
Sets the quantity of the item stack.- Parameters:
amount
- The number of items in the stack.- Returns:
- The updated item stack instance.
- Since:
- 0.2.0.0
-
subtract
Subtracts the specified amount from the current item stack.- Parameters:
amount
- the amount to subtract from the item stack- Returns:
- a new item stack with the specified amount subtracted
- Since:
- 0.2.0.0
-
add
Adds the specified amount to the current amount of this item stack.- Parameters:
amount
- the amount to be added to the item stack- Returns:
- a new AbstractItemStack with the updated amount
- Since:
- 0.2.0.0
-
slot
int slot()Represents the inventory slot of the item stack.- Returns:
- the inventory slot of the item stack.
- Since:
- 0.2.0.0
-
slot
Sets the inventory slot of the item stack.- Parameters:
slot
- The slot index.- Returns:
- The updated item stack instance.
- Since:
- 0.2.0.0
-
debug
Enables or disables debug mode for the item stack.- Parameters:
debug
- True to enable, false to disable.- Returns:
- The updated item stack instance.
- Since:
- 0.2.0.0
-
hasComponent
Checks if a component with the specified identifier is present.- Parameters:
identifier
- The identifier of the component to check.- Returns:
- true if a component with the specified identifier is present, false otherwise.
-
applyComponent
default <C extends SerialComponent<? extends AbstractItemStack<T>,T>> AbstractItemStack<T> applyComponent(C component) Applies a serialized component to the item stack.- Parameters:
component
- The component to apply.- Returns:
- The updated item stack instance.
- Since:
- 0.2.0.0
-
component
default <C extends SerialComponent<? extends AbstractItemStack<T>,T>> Optional<C> component(String identifier) Retrieves a SerialComponent associated with the specified identifier.- Parameters:
identifier
- the identifier of the SerialComponent to retrieve- Returns:
- an Optional containing the SerialComponent if found, empty Optional otherwise
- Since:
- 0.2.0.0
-
applyPersistent
Applies persistent data to the item stack.- Parameters:
data
- The persistent data to apply.- Returns:
- The updated item stack instance.
- Since:
- 0.2.0.0
-
applyPersistentHolder
Replaces the persistent data holder for the item stack.- Parameters:
newHolder
- The new persistent data holder.replaceOld
- True to replace existing data, false to merge.- Returns:
- The updated item stack instance.
- Since:
- 0.2.0.0
-
flags
Retrieves the item flags.- Returns:
- A list of flags applied to the item.
- Since:
- 0.2.0.0
-
components
Retrieves the components applied to the item stack.- Returns:
- A map of component types and their serialized representations.
- Since:
- 0.2.0.0
-
persistentHolder
Retrieves the persistent data holder for the item stack.- Returns:
- The persistent data holder.
- Since:
- 0.2.0.0
-
resetDirty
void resetDirty()Resets the dirty flag, indicating that the object's state has been synchronized with the database. -
markDirty
void markDirty()Marks the item stack as dirty, indicating changes have been made. -
isDirty
boolean isDirty()Checks whether the object is dirty or has unsaved changes.- Returns:
- true if the object is dirty, false otherwise
-
itemProvider
This method returns a String representing the item provider.- Returns:
- the item provider as a String
- See Also:
-
setItemProvider
Sets the item provider to be used for retrieving items.- Parameters:
itemProvider
- the string representing the item provider to be set
-
providerItemID
Retrieves the provider item ID associated with the current object.- Returns:
- The provider item ID of the object.
-
setProviderItemID
Sets the provider's item ID for the current item.- Parameters:
providerItemID
- the unique ID assigned by the provider for the item
-
provider
This method is used to return an ItemProvider object.- Returns:
- ItemProvider object representing the item provider.
-
toJSON
org.json.simple.JSONObject toJSON()Converts the object to a JSONObject representation.- Returns:
- A JSONObject representing the object data.
- Since:
- 0.2.0.0
-
attributeModifiers
Retrieves the AttributeModifiersComponent of the item stack if present.- Returns:
- an Optional containing the AttributeModifiersComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
attributeModifiers
Updates the attribute modifiers of the item stack.- Parameters:
modifiers
- a list of attribute modifiersshowInTooltip
- whether to display the modifiers in the tooltip- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
bannerPatterns
Retrieves the BannerPatternsComponent of the item stack if present.- Returns:
- an Optional containing the BannerPatternsComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
bannerPatterns
Updates the banner patterns of the item stack.- Parameters:
patterns
- a list of pattern data- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
baseColor
Retrieves the BaseColorComponent of the item stack if present.- Returns:
- an Optional containing the BaseColorComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
baseColor
Updates the base color of the item stack.- Parameters:
color
- the new base color- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
blocksAttacks
Retrieves the BlocksAttacksComponent associated with this method.- Returns:
- an Optional containing the BlocksAttacksComponent if found, otherwise an empty Optional
- Since:
- 0.2.0.0
- See Also:
-
blocksAttacks
Blocks attacks with the specified damage type using this item.- Parameters:
damage
- the type of damage to block attacks from- Returns:
- an AbstractItemStack object representing the item after blocking attacks
- Since:
- 0.2.0.0
- See Also:
-
breakSound
Retrieves the break sound component associated with the object.- Returns:
- an Optional containing the BreakSoundComponent if it exists, else an empty Optional
- Since:
- 0.2.0.0
- See Also:
-
breakSound
Set the break sound for this item stack.- Parameters:
sound
- the sound to be played when the item is broken- Returns:
- the updated item stack object
- Since:
- 0.2.0.0
- See Also:
-
bucketEntityData
Retrieves the BucketEntityDataComponent of the item stack if present.- Returns:
- an Optional containing the BucketEntityDataComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
bucketEntityData
AbstractItemStack<T> bucketEntityData(boolean noAI, boolean silent, boolean noGravity, boolean glowing, boolean invulnerable, float health, int age, int variant, long huntingCooldown, int bucketVariantTag, String type) Updates the bucket entity data of the item stack.- Parameters:
noAI
- whether the entity has AI disabledsilent
- whether the entity is silentnoGravity
- whether the entity is affected by gravityglowing
- whether the entity is glowinginvulnerable
- whether the entity is invulnerablehealth
- the health of the entityage
- the age of the entityvariant
- the variant of the entityhuntingCooldown
- the hunting cooldown of the entitybucketVariantTag
- the variant tag of the buckettype
- the type of the entity- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
bundle
Retrieves the bundle component from the components map.- Returns:
- An Optional containing the BundleComponent of AbstractItemStack with type T, or an empty Optional if the bundle component does not exist in the components map.
- Since:
- 0.2.0.0
- See Also:
-
bundle
Bundles a collection ofAbstractItemStack
instances into a single collection.- Parameters:
items
- AMap
containing integer keys andAbstractItemStack
values to be bundled.- Returns:
- An
AbstractItemStack
instance that represents the bundled items. - Since:
- 0.2.0.0
- See Also:
-
canBreak
Retrieves the CanBreakComponent of the item stack if present.- Returns:
- an Optional containing the CanBreakComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
canBreak
Updates the blocks that the item stack can break.- Parameters:
predicates
- a list of block predicates- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
canPlaceOn
Retrieves the CanPlaceOnComponent of the item stack if present.- Returns:
- an Optional containing the CanPlaceOnComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
canPlaceOn
Updates the blocks that the item stack can be placed on.- Parameters:
predicates
- a list of block predicates- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
consumable
Retrieves the ConsumableComponent of the item stack if present.- Returns:
- an Optional containing the ConsumableComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
consumable
AbstractItemStack<T> consumable(float consumeSeconds, String animation, String sound, boolean hasConsumeParticles, List<ComponentEffect> effects) Updates the consumable properties of the item stack.- Parameters:
consumeSeconds
- the time it takes to consume the itemanimation
- the animation to display when consumingsound
- the sound to play when consuminghasConsumeParticles
- whether to show consume particleseffects
- a list of effects applied on consumption- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
container
Returns anOptional
containing theContainerComponent
with type parametersAbstractItemStack
and T stored in this container.- Returns:
- an
Optional
object containing theContainerComponent
with type parametersAbstractItemStack
and T, or an emptyOptional
if the component is not found - Since:
- 0.2.0.0
- See Also:
-
container
Constructs a container with the given map of items.- Parameters:
items
- a map of items where the key is the position of the item in the container and the value is the item- Returns:
- an AbstractItemStack container with the specified items
- Since:
- 0.2.0.0
- See Also:
-
customName
Retrieves the CustomNameComponent of the item stack if present.- Returns:
- an Optional containing the CustomNameComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
customName
Updates the custom name of the item stack.- Parameters:
customName
- the custom name to set- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
damage
Retrieves the DamageComponent of the item stack if present.- Returns:
- an Optional containing the DamageComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
damage
Updates the damage of the item stack.- Parameters:
damage
- the damage value to set- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
damageResistant
Retrieves the DamageResistantComponent of the item stack if present.- Returns:
- an Optional containing the DamageResistantComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
damageResistant
Updates the damage-resistant types of the item stack.- Parameters:
types
- a list of damage-resistant types- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
deathProtection
Retrieves the DeathProtectionComponent of the item stack if present.- Returns:
- an Optional containing the DeathProtectionComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
deathProtection
Updates the death protection effects of the item stack.- Parameters:
deathEffects
- a list of death protection effects- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
dyedColor
Retrieves the DyedColorComponent of the item stack if present.- Returns:
- an Optional containing the DyedColorComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
dyedColor
Updates the dyed color of the item stack.- Parameters:
rgb
- the RGB color value to set- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
enchantable
Retrieves the EnchantableComponent of the item stack if present.- Returns:
- an Optional containing the EnchantableComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
enchantable
Updates the enchantability of the item stack.- Parameters:
value
- the enchantability value to set- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
enchantmentGlintOverride
default Optional<EnchantmentGlintOverrideComponent<AbstractItemStack<T>,T>> enchantmentGlintOverride()Retrieves the EnchantmentGlintOverrideComponent of the item stack if present.- Returns:
- an Optional containing the EnchantmentGlintOverrideComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
enchantmentGlintOverride
Updates the enchantment glint override of the item stack.- Parameters:
glintOverride
- whether the enchantment glint should be overridden- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
enchantments
Retrieves the EnchantmentsComponent of the item stack if present.- Returns:
- an Optional containing the EnchantmentsComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
enchantments
Updates the enchantments of the item stack.- Parameters:
levels
- a map of enchantments and their levels- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
entityVariant
Retrieves the Entity Variant Component for the current stack.- Returns:
- An optional containing the Entity Variant Component if present in the components map, otherwise empty.
- Since:
- 0.2.0.0
- See Also:
-
entityVariant
Generates an AbstractItemStack based on the given entity and variant.- Parameters:
entity
- the entity name to create the stack forvariant
- the variant of the entity- Returns:
- an AbstractItemStack representing the entity with the specified variant
- Since:
- 0.2.0.0
- See Also:
-
equip
Retrieves the EquipComponent of the item stack if present.- Returns:
- an Optional containing the EquipComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
equip
AbstractItemStack<T> equip(String cameraKey, String equipSound, String modelKey, EquipSlot slot, boolean damageOnHurt, boolean dispensable, boolean swappable, boolean equipOnInteract, List<String> entities) Equips an item with specified parameters.- Parameters:
cameraKey
- the key identifying the cameraequipSound
- the key identifying the equip soundmodelKey
- the key identifying the modelslot
- the slot in which the item should be equippeddamageOnHurt
- flag indicating if damage should be taken on hurtdispensable
- flag indicating if the item is dispensableswappable
- flag indicating if the item is swappableequipOnInteract
- flag indicating if the item should be equipped on interactentities
- a list of entities to be equipped- Returns:
- an AbstractItemStack object representing the equipped item
- Since:
- 0.2.0.0
- See Also:
-
fireworkExplosion
Retrieves the FireworkExplosionComponent of the item stack if present.- Returns:
- an Optional containing the FireworkExplosionComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
fireworkExplosion
Updates the firework explosion properties of the item stack.- Parameters:
explosion
- the explosion data to set- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
fireworks
Retrieves the FireworksComponent of the item stack if present.- Returns:
- an Optional containing the FireworksComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
fireworks
Updates the fireworks properties of the item stack.- Parameters:
flightDuration
- the flight duration of the fireworksexplosions
- a list of explosion data- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
food
Retrieves the FoodComponent of the item stack if present.- Returns:
- an Optional containing the FoodComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
food
Updates the food properties of the item stack.- Parameters:
noHunger
- whether the item causes no hungersaturation
- the saturation valuenutrition
- the nutrition value- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
glider
Retrieves the GliderComponent of the item stack if present.- Returns:
- an Optional containing the GliderComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
gliderTag
Updates the item stack to enable glider functionality.- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
hideAdditionalTooltip
Retrieves the HideAdditionalTooltipComponent of the item stack if present.- Returns:
- an Optional containing the HideAdditionalTooltipComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
hideAdditionalTooltipTag
Updates the item stack to hide additional tooltip.- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
hideTooltip
Retrieves the HideTooltipComponent of the item stack if present.- Returns:
- an Optional containing the HideTooltipComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
hideTooltipTag
Updates the item stack to hide its tooltip.- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
instrument
Retrieves the InstrumentComponent of the item stack if present.- Returns:
- an Optional containing the InstrumentComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
instrument
Updates the instrument properties of the item stack.- Parameters:
soundEvent
- the sound event identifieruseDuration
- the duration of the sound in ticksrange
- the range of the sound- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
intangibleProjectile
Retrieves the IntangibleProjectileComponent of the item stack if present.- Returns:
- an Optional containing the IntangibleProjectileComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
intangibleProjectileTag
Updates the item stack as an intangible projectile.- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
itemModel
Retrieves the ItemModelComponent of the item stack if present.- Returns:
- an Optional containing the ItemModelComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
itemModel
Updates the model properties of the item stack.- Parameters:
model
- the model identifier- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
itemName
Retrieves the ItemNameComponent of the item stack if present.- Returns:
- an Optional containing the ItemNameComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
itemName
Updates the name of the item stack.- Parameters:
itemName
- the name of the item- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
jukebox
Retrieves the JukeBoxComponent of the item stack if present.- Returns:
- an Optional containing the JukeBoxComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
jukebox
Updates the jukebox properties of the item stack.- Parameters:
song
- the song identifiershowInTooltip
- whether to display the song in the tooltip- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
lodestoneTracker
Retrieves the LodestoneTrackerComponent of the item stack if present.- Returns:
- an Optional containing the LodestoneTrackerComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
lodestoneTracker
Updates the lodestone tracker properties of the item stack.- Parameters:
target
- the target identifierpos
- the position arraydimension
- the dimension identifiertracked
- whether the lodestone is tracked- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
lore
Retrieves the LoreComponent of the item stack if present.- Returns:
- an Optional containing the LoreComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
lore
Updates the lore of the item stack.- Parameters:
lore
- a list of lore strings- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
mapColor
Retrieves the MapColorComponent of the item stack if present.- Returns:
- an Optional containing the MapColorComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
mapColor
Updates the map color of the item stack.- Parameters:
mapColor
- the map color value- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
mapId
Retrieves the MapIDComponent of the item stack if present.- Returns:
- an Optional containing the MapIDComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
mapId
Updates the map ID of the item stack.- Parameters:
mapId
- the map ID value- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
maxDamage
Retrieves the MaxDamageComponent of the item stack if present.- Returns:
- an Optional containing the MaxDamageComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
maxDamage
Updates the maximum damage of the item stack.- Parameters:
maxDamage
- the maximum damage value- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
maxStackSize
Retrieves the MaxStackSizeComponent of the item stack if present.- Returns:
- an Optional containing the MaxStackSizeComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
maxStackSize
Updates the maximum stack size of the item stack.- Parameters:
maxStackSize
- the maximum stack size value- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
modelData
Retrieves the ModelDataComponent of the item stack if present.- Returns:
- an Optional containing the ModelDataComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
modelData
AbstractItemStack<T> modelData(List<String> colours, List<Float> floats, List<Boolean> flags, List<String> strings) Updates the model data of the item stack.- Parameters:
colours
- a list of color stringsfloats
- a list of float valuesflags
- a list of boolean flagsstrings
- a list of string identifiers- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
modelDataOld
Deprecated.Since MC 1.21.3 UseItemModelComponent
andModelDataComponent
.Retrieves the ModelDataOldComponent of the item stack if present.- Returns:
- an Optional containing the ModelDataOldComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
modelDataOld
Deprecated.Since MC 1.21.3 UseItemModelComponent
andModelDataComponent
.Retrieves the model data for a custom item stack.- Parameters:
customModelData
- the custom model data to retrieve- Returns:
- an AbstractItemStack with the specified custom model data
- Since:
- 0.2.0.0
- See Also:
-
noteBlockSound
Retrieves the NoteBlockSoundComponent of the item stack if present.- Returns:
- an Optional containing the NoteBlockSoundComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
noteBlockSound
Updates the note block sound of the item stack.- Parameters:
soundId
- the identifier of the sound- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
ominousBottleAmplifier
Retrieves the OminousBottleAmplifierComponent of the item stack if present.- Returns:
- an Optional containing the OminousBottleAmplifierComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
ominousBottleAmplifier
Updates the ominous bottle amplifier of the item stack.- Parameters:
amplifier
- the amplifier value- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
potDecorations
Retrieves the PotDecorationsComponent of the item stack if present.- Returns:
- an Optional containing the PotDecorationsComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
potDecorations
Updates the pot decorations of the item stack.- Parameters:
decorations
- a list of decorations- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
potionContents
Retrieves the PotionContentsComponent of the item stack if present.- Returns:
- an Optional containing the PotionContentsComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
potionContents
AbstractItemStack<T> potionContents(String potionId, int customColor, String customName, List<EffectInstance> effects) Updates the potion contents of the item stack.- Parameters:
potionId
- the ID of the potioncustomColor
- the custom color of the potioncustomName
- the custom name of the potioneffects
- a list of effect instances- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
potionDuration
Retrieves the potion duration scale component from the item's components. Since MC Snapshot 25w02a.- Returns:
- an Optional containing the PotionDurationScaleComponent if present, otherwise an empty Optional
- Since:
- 0.2.0.0
- See Also:
-
potionDuration
Sets the duration of a potion effect for the item stack. Since MC Snapshot 25w02a.- Parameters:
potionDuration
- the duration of the potion effect in seconds- Returns:
- the modified AbstractItemStack object with the updated potion duration
- Since:
- 0.2.0.0
- See Also:
-
profile
Retrieves the profile component from the components map if it exists.- Returns:
- An Optional containing the profile component if found, or an empty Optional otherwise.
- Since:
- 0.2.0.0
- See Also:
-
profile
Create a Profile based on the provided name and UUID.- Parameters:
name
- The name for the profile.uuid
- The UUID for the profile.- Returns:
- A new AbstractItemStack based on the created SkullProfile with the given name and UUID.
- Since:
- 0.2.0.0
- See Also:
-
profile
Profiles the item stack with the given name, UUID, and texture.- Parameters:
name
- The name of the profile.uuid
- The UUID of the profile.texture
- The texture of the profile.- Returns:
- The AbstractItemStack with the specified profile.
- Since:
- 0.2.0.0
- See Also:
-
profile
Profiles the given SkullProfile to the AbstractItemStack object.- Parameters:
profile
- the SkullProfile to be assigned- Returns:
- an AbstractItemStack object with the provided profile
-
providesPattern
Retrieves the component that provides banner patterns.- Returns:
- an Optional containing the ProvidesBannerPatternsComponent for the specified item stack type T, or an empty Optional if the component is not present
- Since:
- 0.2.0.0
- See Also:
-
providesPattern
Retrieve an AbstractItemStack object that provides a specific pattern identified by the patternTag.- Parameters:
patternTag
- The unique identifier of the pattern to be provided.- Returns:
- An AbstractItemStack object that provides the specified pattern.
- Since:
- 0.2.0.0
- See Also:
-
providesTrim
Retrieves the component responsible for providing trim materials.- Returns:
- An Optional containing the ProvidesTrimMaterialComponent for trim, or an empty Optional if not found.
- Since:
- 0.2.0.0
- See Also:
-
providesTrim
Applies the specified trim material- Parameters:
material
- the trim material- Returns:
- an AbstractItemStack object representing the trimmed material
- Since:
- 0.2.0.0
- See Also:
-
rarity
Retrieves the RarityComponent of the item stack if present.- Returns:
- an Optional containing the RarityComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
rarity
Updates the rarity of the item stack.- Parameters:
rarity
- the rarity value- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
recipes
Retrieves the RecipesComponent of the item stack if present.- Returns:
- an Optional containing the RecipesComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
recipes
Updates the recipes of the item stack.- Parameters:
recipes
- a list of recipe identifiers- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
repairable
Retrieves the RepairableComponent of the item stack if present.- Returns:
- an Optional containing the RepairableComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
repairable
Updates the repairable items of the item stack.- Parameters:
repairItems
- a list of repair item identifiers- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
repairCost
Retrieves the RepairCostComponent of the item stack if present.- Returns:
- an Optional containing the RepairCostComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
repairCost
Updates the repair cost of the item stack.- Parameters:
repairCost
- the repair cost value- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
storedEnchantments
Retrieves the StoredEnchantmentsComponent of the item stack if present.- Returns:
- an Optional containing the StoredEnchantmentsComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
storedEnchantments
Updates the stored enchantments of the item stack.- Parameters:
enchantments
- a map of enchantment names to their levels- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
suspiciousStewEffects
Retrieves the SuspiciousStewEffectsComponent of the item stack if present.- Returns:
- an Optional containing the SuspiciousStewEffectsComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
suspiciousStewEffects
Applies the given effects to the suspicious stew item.- Parameters:
effects
- a list of EffectInstance objects representing the effects to be applied to the suspicious stew- Returns:
- an AbstractItemStack representing the suspicious stew with the applied effects
- Since:
- 0.2.0.0
- See Also:
-
suspiciousStewEffects
Applies the given effects to a suspicious stew item.- Parameters:
effects
- an array of EffectInstance objects representing the effects to apply to the suspicious stew- Returns:
- an AbstractItemStack representing the suspicious stew item with the applied effects
- Since:
- 0.2.0.0
- See Also:
-
tool
Retrieves the ToolComponent of the item stack if present.- Returns:
- an Optional containing the ToolComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
tool
AbstractItemStack<T> tool(float defaultSpeed, int blockDamage, boolean canDestroyBlocksCreative, List<ToolRule> rules) Constructs a new tool item with the specified characteristics.- Parameters:
defaultSpeed
- the default speed of the toolblockDamage
- the damage inflicted by the tool to blockscanDestroyBlocksCreative
- if the tool can destroy blocks in creative moderules
- a list of rules that define the behavior of the tool- Returns:
- an AbstractItemStack instance representing the created tool
- Since:
- 0.2.0.0
- See Also:
-
tooltipDisplay
Retrieves the tooltip display component associated with the item.- Returns:
- An Optional containing the tooltip display component, or empty if none is found.
- Since:
- 0.2.0.0
- See Also:
-
tooltipDisplay
Displays tooltip for the item stack with an option to hide certain components.- Parameters:
hideTooltip
- Flag to hide the tooltiphiddenComponents
- Array of components to hide in the tooltip- Returns:
- An AbstractItemStack object with the tooltip displayed
- Since:
- 0.2.0.0
- See Also:
-
tooltipStyle
Retrieves the TooltipStyleComponent of the item stack if present.- Returns:
- an Optional containing the TooltipStyleComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
tooltipStyle
Updates the tooltip style of the item stack.- Parameters:
style
- the style to apply to the tooltip- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
trim
Retrieves the TrimComponent of the item stack if present.- Returns:
- an Optional containing the TrimComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
trim
Updates the trim properties of the item stack.- Parameters:
pattern
- the trim patternmaterial
- the trim materialshowInTooltip
- whether to display the trim in the tooltip- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
unbreakable
Retrieves the UnbreakableComponent of the item stack if present.- Returns:
- an Optional containing the UnbreakableComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
unbreakable
Updates the unbreakable property of the item stack.- Parameters:
showInTooltip
- whether to display the unbreakable property in the tooltip- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
useCooldown
Retrieves the UseCooldownComponent of the item stack if present.- Returns:
- an Optional containing the UseCooldownComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
useCooldown
Updates the use cooldown properties of the item stack.- Parameters:
cooldownGroup
- the cooldown group identifierseconds
- the cooldown duration in seconds- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
weapon
Retrieves the weapon component associated with this item. Since MC Snapshot 25w02a.- Returns:
- an Optional containing the weapon component if it exists, otherwise an empty Optional.
- Since:
- 0.2.0.0
- See Also:
-
weapon
Represents a weapon item that can be used for combat. Since MC Snapshot 25w02a.- Parameters:
damagePerAttack
- The amount of damage this weapon inflicts per attackcanDisableBlocking
- Whether this weapon can disable blocking when used- Since:
- 0.2.0.0
- See Also:
-
writableBookContent
Retrieves the WritableBookContentComponent of the item stack if present.- Returns:
- an Optional containing the WritableBookContentComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
writableBookContent
Updates the writable book content of the item stack.- Parameters:
pages
- the pages to include in the writable book- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
writtenBookContent
Retrieves the WrittenBookContentComponent of the item stack if present.- Returns:
- an Optional containing the WrittenBookContentComponent if it exists
- Since:
- 0.2.0.0
- See Also:
-
writtenBookContent
AbstractItemStack<T> writtenBookContent(String title, String author, int generation, boolean resolved, List<String> pages) Updates the written book content of the item stack.- Parameters:
title
- the title of the bookauthor
- the author of the bookgeneration
- the generation of the bookresolved
- whether the book is resolvedpages
- the pages to include in the book- Returns:
- the updated AbstractItemStack instance
- Since:
- 0.2.0.0
- See Also:
-
ItemModelComponent
andModelDataComponent
.