IItemStack
Importing the class
If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.
import crafttweaker.api.item.IItemStack;Implements
IItemStack
implements the following interfaces:
IIngredient,IIngredientWithAmount,DataComponentHolder,ComponentAccess<IItemStack>,CommandStringDisplayable
Undocumented Interfaces
IDataComponentHolderExtension
Operators
myIIngredient in myIItemStackParameters:
Return Type:
bool
// (IItemStack * (amount as int)) as IIngredientWithAmountmyIItemStack * myIntParameters:
amount: int Type: int
Return Type:
IIngredientWithAmount
myIItemStack | myIIngredientParameters:
other: IIngredient Type: IIngredient
Return Type:
IIngredientList
myIItemStack % myDoubleParameters:
percentage: double Type: double
Return Type:
Percentaged<IItemStack>
// (IItemStack * (amount as int)) as IItemStackmyIItemStack * myIntParameters:
amount: int Type: int
- new amount
Return Type:
IItemStack
Members
Please use Item Components instead.
// IItemStack.addGlobalAttributeModifier(attribute as Attribute, id as ResourceLocation, value as double, operation as AttributeOperation, slotTypes as EquipmentSlot[]);myIItemStack.addGlobalAttributeModifier(myAttribute, myResourceLocation, myDouble, myOperation, myEquipmentSlot[]);Parameters:
id: ResourceLocation Type: ResourceLocation value: double Type: double operation: AttributeOperation Type: AttributeOperation slotTypes: EquipmentSlot[] Type: EquipmentSlot[] // IItemStack.amount as intmyIItemStack.amount
Return Type:
int
myIItemStack.applyComponents(myDataComponentMap);Parameters:
map: DataComponentMap Type: DataComponentMap
Return Type:
IItemStack
myIItemStack.applyComponents(myDataComponentPatch);Parameters:
patch: DataComponentPatch Type: DataComponentPatch
Return Type:
IItemStack
myIItemStack.applyComponentsAndValidate(myDataComponentPatch);Parameters:
patch: DataComponentPatch Type: DataComponentPatch
Return Type:
IItemStack
// IItemStack as IIngredientWithAmountmyIItemStack as IIngredientWithAmount
Return Type:
IIngredientWithAmount
myIItemStack as Percentaged<IItemStack>
Return Type:
Percentaged<IItemStack>
// IItemStack.attributeModifiers as ItemAttributeModifiersmyIItemStack.attributeModifiers
Return Type:
ItemAttributeModifiers
// IItemStack.bannerPatterns as BannerPatternLayersmyIItemStack.bannerPatterns
Return Type:
BannerPatternLayers
// IItemStack.BASE_ATTACK_DAMAGE_ID as ResourceLocationIItemStack.BASE_ATTACK_DAMAGE_ID
Return Type:
ResourceLocation
// IItemStack.BASE_ATTACK_SPEED_ID as ResourceLocationIItemStack.BASE_ATTACK_SPEED_ID
Return Type:
ResourceLocation
myIItemStack.bees
Return Type:
List<BeehiveBlockEntityOccupant>
// IItemStack.blockEntityData as CustomDatamyIItemStack.blockEntityData
Return Type:
CustomData
// IItemStack.blockState as BlockItemStatePropertiesmyIItemStack.blockState
Return Type:
BlockItemStateProperties
// IItemStack.bucketEntityData as CustomDatamyIItemStack.bucketEntityData
Return Type:
CustomData
// IItemStack.bundleContents as BundleContentsmyIItemStack.bundleContents
Return Type:
BundleContents
// IItemStack.burnTime as intmyIItemStack.burnTime
Return Type:
int
// IItemStack.burnTime = (time as int);myIItemStack.burnTime = myInt;Parameters:
time: int Type: int
- the new burn time // IItemStack.burnTime(time as int);myIItemStack.burnTime(500);Parameters:
time: int Type: int
- the new burn time // IItemStack.canBreak as AdventureModePredicatemyIItemStack.canBreak
Return Type:
AdventureModePredicate
// IItemStack.canPlaceOn as AdventureModePredicatemyIItemStack.canPlaceOn
Return Type:
AdventureModePredicate
// IItemStack.chargedProjectiles as ChargedProjectilesmyIItemStack.chargedProjectiles
Return Type:
ChargedProjectiles
// IItemStack.clearTooltip(leaveName as bool = false);myIItemStack.clearTooltip(myBool);Parameters:
leaveName: bool (optional) Type: bool
Default Value: false
// IItemStack.componentsPatch as DataComponentPatchmyIItemStack.componentsPatch
Return Type:
DataComponentPatch
// IItemStack.container as ItemContainerContentsmyIItemStack.container
Return Type:
ItemContainerContents
// IItemStack.containerLoot as SeededContainerLootmyIItemStack.containerLoot
Return Type:
SeededContainerLoot
myIItemStack.contains((<item:minecraft:iron_ingot> | <item:minecraft:gold_ingot>));Parameters:
Return Type:
bool
// IItemStack.CRAFTTWEAKER_DATA_KEY as stringIItemStack.CRAFTTWEAKER_DATA_KEY
Return Type:
string
// IItemStack.creativeSlotLock as boolmyIItemStack.creativeSlotLock
Return Type:
bool
// IItemStack.customData as CustomDatamyIItemStack.customData
Return Type:
CustomData
// IItemStack.customModelData as CustomModelDatamyIItemStack.customModelData
Return Type:
CustomModelData
// IItemStack.damage as intmyIItemStack.damage
Return Type:
int
// IItemStack.damageableItem as boolmyIItemStack.damageableItem
Return Type:
bool
// IItemStack.damaged as boolmyIItemStack.damaged
Return Type:
bool
// IItemStack.debugStickState as DebugStickStatemyIItemStack.debugStickState
Return Type:
DebugStickState
// IItemStack.definition as ItemDefinitionmyIItemStack.definition
Return Type:
ItemDefinition
// IItemStack as ItemDefinitionmyIItemStack as Item
Return Type:
ItemDefinition
// IItemStack.descriptionId as stringmyIItemStack.descriptionId
Return Type:
string
// IItemStack.dyedColor as DyedItemColormyIItemStack.dyedColor
Return Type:
DyedItemColor
If it is present, it is first checked to determine whether there is special behaviour, otherwise the code checks for enchantments.
// IItemStack.enchantmentGlintOverride as boolmyIItemStack.enchantmentGlintOverride
Return Type:
bool
// IItemStack.enchantments as ItemEnchantmentsmyIItemStack.enchantments
Return Type:
ItemEnchantments
// IItemStack.entityData as CustomDatamyIItemStack.entityData
Return Type:
CustomData
// IItemStack.fireworkExplosion as FireworkExplosionmyIItemStack.fireworkExplosion
Return Type:
FireworkExplosion
// IItemStack.food as FoodPropertiesmyIItemStack.food
Return Type:
FoodProperties
Returns: A Map of Attribute to a List of AttributeModifier for the given EquipmentSlot.
myIItemStack.getAttributes(<constant:minecraft:equipmentslot:chest>);Parameters:
Return Type:
List<AttributeModifier>[Attribute]
myIItemStack.getRemainingItem(<item:minecraft:iron_ingot>);Parameters:
Return Type:
IItemStack
Returns: use duration
myIItemStack.getUseDuration(entity);Parameters:
entity: LivingEntity Type: LivingEntity
Return Type:
int
Returns: This IItemStack if mutable, a new one with the new amount otherwise.
myIItemStack.grow(2);Parameters:
amount: int (optional) Type: int
- The amount to grow by.
Default Value: 1
Return Type:
IItemStack
// IItemStack.hasAttributeModifiers as boolmyIItemStack.hasAttributeModifiers
Return Type:
bool
// IItemStack.hasBannerPatterns as boolmyIItemStack.hasBannerPatterns
Return Type:
bool
Used for shield colouring.
// IItemStack.hasBaseColor as boolmyIItemStack.hasBaseColor
Return Type:
bool
// IItemStack.hasBees as boolmyIItemStack.hasBees
Return Type:
bool
// IItemStack.hasBlockEntityData as boolmyIItemStack.hasBlockEntityData
Return Type:
bool
// IItemStack.hasBlockState as boolmyIItemStack.hasBlockState
Return Type:
bool
// IItemStack.hasBucketEntityData as boolmyIItemStack.hasBucketEntityData
Return Type:
bool
// IItemStack.hasBundleContents as boolmyIItemStack.hasBundleContents
Return Type:
bool
// IItemStack.hasCanBreak as boolmyIItemStack.hasCanBreak
Return Type:
bool
// IItemStack.hasCanPlaceOn as boolmyIItemStack.hasCanPlaceOn
Return Type:
bool
This component is used for crossbows.
// IItemStack.hasChargedProjectiles as boolmyIItemStack.hasChargedProjectiles
Return Type:
bool
// IItemStack.hasContainer as boolmyIItemStack.hasContainer
Return Type:
bool
// IItemStack.hasContainerLoot as boolmyIItemStack.hasContainerLoot
Return Type:
bool
// IItemStack.hasCustomData as boolmyIItemStack.hasCustomData
Return Type:
bool
// IItemStack.hasCustomModelData as boolmyIItemStack.hasCustomModelData
Return Type:
bool
// IItemStack.hasCustomName as boolmyIItemStack.hasCustomName
Return Type:
bool
// IItemStack.hasDamage as boolmyIItemStack.hasDamage
Return Type:
bool
// IItemStack.hasDebugStickState as boolmyIItemStack.hasDebugStickState
Return Type:
bool
// IItemStack.hasDyedColor as boolmyIItemStack.hasDyedColor
Return Type:
bool
// IItemStack.hasEnchantmentGlintOverride as boolmyIItemStack.hasEnchantmentGlintOverride
Return Type:
bool
// IItemStack.hasEnchantments as boolmyIItemStack.hasEnchantments
Return Type:
bool
// IItemStack.hasEntityData as boolmyIItemStack.hasEntityData
Return Type:
bool
// IItemStack.hasFireworkExplosion as boolmyIItemStack.hasFireworkExplosion
Return Type:
bool
// IItemStack.hasFireworks as boolmyIItemStack.hasFireworks
Return Type:
bool
Foil is the glint / effect that is added to enchanted ItemStacks (and other items).
// IItemStack.hasFoil as boolmyIItemStack.hasFoil
Return Type:
bool
// IItemStack.hasFood as boolmyIItemStack.hasFood
Return Type:
bool
// IItemStack.hasInstrument as boolmyIItemStack.hasInstrument
Return Type:
bool
// IItemStack.hasItemName as boolmyIItemStack.hasItemName
Return Type:
bool
// IItemStack.hasLock as boolmyIItemStack.hasLock
Return Type:
bool
// IItemStack.hasLodestoneTracker as boolmyIItemStack.hasLodestoneTracker
Return Type:
bool
// IItemStack.hasLore as boolmyIItemStack.hasLore
Return Type:
bool
// IItemStack.hasMapColor as boolmyIItemStack.hasMapColor
Return Type:
bool
MapDecorations are additional elements that render on a map, such as waypoints.
// IItemStack.hasMapDecorations as boolmyIItemStack.hasMapDecorations
Return Type:
bool
// IItemStack.hasMapId as boolmyIItemStack.hasMapId
Return Type:
bool
This componenet stores additional info on the map, such as the scale or whether to lock it.
// IItemStack.hasMapPostProcessing as boolmyIItemStack.hasMapPostProcessing
Return Type:
bool
// IItemStack.hasMaxDamage as boolmyIItemStack.hasMaxDamage
Return Type:
bool
// IItemStack.hasMaxStackSize as boolmyIItemStack.hasMaxStackSize
Return Type:
bool
// IItemStack.hasNoteBlockSound as boolmyIItemStack.hasNoteBlockSound
Return Type:
bool
// IItemStack.hasOminousBottleAmplifier as boolmyIItemStack.hasOminousBottleAmplifier
Return Type:
bool
// IItemStack.hasPotDecorations as boolmyIItemStack.hasPotDecorations
Return Type:
bool
Stores Potion Data on an item.
// IItemStack.hasPotionContents as boolmyIItemStack.hasPotionContents
Return Type:
bool
// IItemStack.hasProfile as boolmyIItemStack.hasProfile
Return Type:
bool
// IItemStack.hasRarity as boolmyIItemStack.hasRarity
Return Type:
bool
Used for Knowledge Books.
// IItemStack.hasRecipes as boolmyIItemStack.hasRecipes
Return Type:
bool
// IItemStack.hasRepairCost as boolmyIItemStack.hasRepairCost
Return Type:
bool
The stored enchantments component is only present in enchanted books, since it just stores the enchantments under a lid for future use. The item is not enchanted.
// IItemStack.hasStoredEnchantments as boolmyIItemStack.hasStoredEnchantments
Return Type:
bool
// IItemStack.hasSuspiciousStewEffects as boolmyIItemStack.hasSuspiciousStewEffects
Return Type:
bool
// IItemStack.hasTool as boolmyIItemStack.hasTool
Return Type:
bool
// IItemStack.hasTrim as boolmyIItemStack.hasTrim
Return Type:
bool
// IItemStack.hasUnbreakable as boolmyIItemStack.hasUnbreakable
Return Type:
bool
// IItemStack.hasWritableBookContent as boolmyIItemStack.hasWritableBookContent
Return Type:
bool
// IItemStack.hasWrittenBookContent as boolmyIItemStack.hasWrittenBookContent
Return Type:
bool
// IItemStack.hideAdditionalTooltip as boolmyIItemStack.hideAdditionalTooltip
Return Type:
bool
// IItemStack.hideTooltip as boolmyIItemStack.hideTooltip
Return Type:
bool
// IItemStack.instrument as InstrumentmyIItemStack.instrument
Return Type:
Instrument
// IItemStack.isEnchantable as boolmyIItemStack.isEnchantable
Return Type:
bool
// IItemStack.isFireResistant as boolmyIItemStack.isFireResistant
Return Type:
bool
// IItemStack.isImmutable as boolmyIItemStack.isImmutable
Return Type:
bool
// IItemStack.isImmutable() as bool;myIItemStack.isImmutable();
Return Type:
bool
// IItemStack.isIntangibleProjectile as boolmyIItemStack.isIntangibleProjectile
Return Type:
bool
// IItemStack.isMutable as boolmyIItemStack.isMutable
Return Type:
bool
// IItemStack.isMutable() as bool;myIItemStack.isMutable();
Return Type:
bool
myIItemStack.items
Return Type:
IItemStack[]
// IItemStack.lodestoneTracker as LodestoneTrackermyIItemStack.lodestoneTracker
Return Type:
LodestoneTracker
// IItemStack.mapColor as MapItemColormyIItemStack.mapColor
Return Type:
MapItemColor
// IItemStack.mapDecorations as MapDecorationsmyIItemStack.mapDecorations
Return Type:
MapDecorations
// IItemStack.mapPostProcessing as MapPostProcessingmyIItemStack.mapPostProcessing
Return Type:
MapPostProcessing
// IItemStack.maxDamage as intmyIItemStack.maxDamage
Return Type:
int
// IItemStack.maxStackSize as intmyIItemStack.maxStackSize
Return Type:
int
// IItemStack.modifyShiftTooltip(shiftedFunction as ITooltipFunction, unshiftedFunction as ITooltipFunction = null);myIItemStack.modifyShiftTooltip(myITooltipFunction, myITooltipFunction);Parameters:
shiftedFunction: ITooltipFunction Type: ITooltipFunction myIItemStack.modifyTooltip(myITooltipFunction);Parameters:
function: ITooltipFunction Type: ITooltipFunction myIItemStack.mul(myInt);Parameters:
amount: int Type: int
Return Type:
IIngredientWithAmount
// IItemStack.noteBlockSound as ResourceLocationmyIItemStack.noteBlockSound
Return Type:
ResourceLocation
// IItemStack.ominousBottleAmplifier as intmyIItemStack.ominousBottleAmplifier
Return Type:
int
myIItemStack.onlyDamagedAtLeast(myInt);Parameters:
minDamage: int Type: int
Return Type:
IIngredient
myIItemStack.onlyDamagedAtMost(myInt);Parameters:
maxDamage: int Type: int
Return Type:
IIngredient
// IItemStack.onlyIf(uid as string, function as function(t as IItemStack) as bool = null) as IIngredient;myIItemStack.onlyIf(myString, myPredicate);Parameters:
uid: string Type: string function: function(t as IItemStack) as bool (optional) Type: function(t as IItemStack) as bool
Default Value: null
Return Type:
IIngredient
// IItemStack.owner as stringmyIItemStack.owner
Return Type:
string
myIItemStack.percent(myDouble);Parameters:
percentage: double Type: double
Return Type:
Percentaged<IItemStack>
// IItemStack.potDecorations as PotDecorationsmyIItemStack.potDecorations
Return Type:
PotDecorations
// IItemStack.potionContents as PotionContentsmyIItemStack.potionContents
Return Type:
PotionContents
// IItemStack.potPattern as DecoratedPotPatternmyIItemStack.potPattern
Return Type:
DecoratedPotPattern
myIItemStack.potPatternId
Return Type:
ResourceKey<DecoratedPotPattern>
// IItemStack.profile as ResolvableProfilemyIItemStack.profile
Return Type:
ResolvableProfile
// IItemStack.prototype as DataComponentMapmyIItemStack.prototype
Return Type:
DataComponentMap
myIItemStack.recipes
Return Type:
List<ResourceLocation>
// IItemStack.registryName as ResourceLocationmyIItemStack.registryName
Return Type:
ResourceLocation
myIItemStack.remove<T>(myDataComponentType);Parameters:
type: DataComponentType<T> Type: DataComponentType<T>
Return Type:
IItemStack
Please use Item Components instead.
myIItemStack.removeGlobalAttribute(myAttribute, myEquipmentSlot[]);Parameters:
slotTypes: EquipmentSlot[] Type: EquipmentSlot[] Please use Item Components instead.
myIItemStack.removeGlobalAttributeModifier(myString, myEquipmentSlot[]);Parameters:
uuid: string Type: string slotTypes: EquipmentSlot[] Type: EquipmentSlot[] Please use Item Components instead.
myIItemStack.removeGlobalAttributeModifier(myUUID, myEquipmentSlot[]);Parameters:
uuid: UUID Type: UUID slotTypes: EquipmentSlot[] Type: EquipmentSlot[] // IItemStack.removeTooltip(regex as string);myIItemStack.removeTooltip(myString);Parameters:
regex: string Type: string // IItemStack.repairCost as intmyIItemStack.repairCost
Return Type:
int
Returns: This IItemStack if mutable, a new one with the new amount otherwise.
myIItemStack.shrink(2);Parameters:
amount: int (optional) Type: int
- The amount to shrink by.
Default Value: 1
Return Type:
IItemStack
// IItemStack.stackable as boolmyIItemStack.stackable
Return Type:
bool
// IItemStack.storedEnchantments as ItemEnchantmentsmyIItemStack.storedEnchantments
Return Type:
ItemEnchantments
// IItemStack.suspiciousStewEffects as SuspiciousStewEffectsmyIItemStack.suspiciousStewEffects
Return Type:
SuspiciousStewEffects
// IItemStack.transformCustom(uid as string, function as function(r as IItemStack) as IItemStack = null) as IIngredient;myIItemStack.transformCustom(myString, myFunction);Parameters:
uid: string Type: string function: function(r as IItemStack) as IItemStack (optional) Type: function(r as IItemStack) as IItemStack
Default Value: null
Return Type:
IIngredient
myIItemStack.transformDamage(myInt);Parameters:
amount: int (optional) Type: int
Default Value: 1
Return Type:
IIngredient
myIItemStack.transformReplace(myIItemStack);Parameters:
replaceWith: IItemStack Type: IItemStack
Return Type:
IIngredient
// IItemStack.unbreakable as UnbreakablemyIItemStack.unbreakable
Return Type:
Unbreakable
// IItemStack.update<T, U>(type as DataComponentType<T>, defaultValue as T, data as U, operator as BiFunction<T, T, U>) as IItemStack;myIItemStack.update<T, U>(myDataComponentType, myT, myU, myBiFunction);Parameters:
type: DataComponentType<T> Type: DataComponentType<T> defaultValue: T Type: T data: U Type: U operator: BiFunction<T, T, U> Type: BiFunction<T, T, U>
Return Type:
IItemStack
// IItemStack.update<T>(type as DataComponentType<T>, defaultValue as T, operator as UnaryOperator<T>) as IItemStack;myIItemStack.update<T>(myDataComponentType, myT, myUnaryOperator);Parameters:
type: DataComponentType<T> Type: DataComponentType<T> defaultValue: T Type: T operator: UnaryOperator<T> Type: UnaryOperator<T>
Return Type:
IItemStack
// IItemStack.useOnRelease as boolmyIItemStack.useOnRelease
Return Type:
bool
myIItemStack.with<T>(myDataComponentType, myT);Parameters:
type: DataComponentType<T> Type: DataComponentType<T> value: T? Type: T?
Return Type:
IItemStack
ItemAttributeModifiersReturns: The new instance with the modified data.
myIItemStack.withAttributeModifiers(ItemAttributeModifiers.builder().add(<attribute:minecraft:player.block_break_speed>,AttributeModifier.create("test", 2.0, <constant:minecraft:attribute/operation:add_value>, "596e0826-7c66-42c6-b3da-45a6d667ccf7"),<constant:minecraft:equipmentslot/group:mainhand>).build(););Parameters:
modifiers: ItemAttributeModifiers Type: ItemAttributeModifiers
- The attributes to give to the item.
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// IItemStack.withAttributeModifiers(modifier as ItemAttributeModifiersEntry, showInTooltip as bool = true) as ComponentAccess;myIItemStack.withAttributeModifiers(myEntry, myBool);Parameters:
modifier: ItemAttributeModifiersEntry Type: ItemAttributeModifiersEntry showInTooltip: bool (optional) Type: bool
Default Value: true
Return Type:
ComponentAccess
// IItemStack.withAttributeModifiers(modifiers as List<ItemAttributeModifiersEntry>, showInTooltip as bool = true) as ComponentAccess;myIItemStack.withAttributeModifiers(myList, myBool);Parameters:
modifiers: List<ItemAttributeModifiersEntry> Type: List<ItemAttributeModifiersEntry> showInTooltip: bool (optional) Type: bool
Default Value: true
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withBannerPatterns(myList);Parameters:
layers: List<BannerPatternLayersLayer> Type: List<BannerPatternLayersLayer>
Return Type:
ComponentAccess
BannerPatternLayersReturns: The new instance with the modified data.
myIItemStack.withBannerPatterns(myBannerPatternLayers);Parameters:
layers: BannerPatternLayers Type: BannerPatternLayers
Return Type:
ComponentAccess
DyeColorReturns: The new instance with the modified data.
myIItemStack.withBaseColor(myDyeColor);
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withBees(myList);Parameters:
occupants: List<BeehiveBlockEntityOccupant> Type: List<BeehiveBlockEntityOccupant>
Return Type:
ComponentAccess
MapDataReturns: The new instance with the modified data.
myIItemStack.withBlockEntityData(myMapData);
Return Type:
ComponentAccess
CustomDataReturns: The new instance with the modified data.
myIItemStack.withBlockEntityData(myCustomData);Parameters:
data: CustomData Type: CustomData
Return Type:
ComponentAccess
BlockItemStatePropertiesReturns: The new instance with the modified data.
myIItemStack.withBlockState(myBlockItemStateProperties);Parameters:
properties: BlockItemStateProperties Type: BlockItemStateProperties
Return Type:
ComponentAccess
MapDataReturns: The new instance with the modified data.
myIItemStack.withBucketEntityData(myMapData);
Return Type:
ComponentAccess
CustomDataReturns: The new instance with the modified data.
myIItemStack.withBucketEntityData(myCustomData);Parameters:
data: CustomData Type: CustomData
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withBundleContents([<item:minecraft:diamond> * 64]);Parameters:
Return Type:
ComponentAccess
BundleContentsReturns: The new instance with the modified data.
myIItemStack.withBundleContents(myBundleContents);Parameters:
contents: BundleContents Type: BundleContents
Return Type:
ComponentAccess
Any predicate that matches will allow the Block to be broken by this ItemStack.
Returns: The new instance with the modified data.
// IItemStack.withCanBreak(predicates as List<BlockPredicate>, showInTooltip as bool = true) as ComponentAccess;myIItemStack.withCanBreak(BlockPredicate.create().of(<block:minecraft:diamond_ore>).build(), true);Parameters:
predicates: List<BlockPredicate> Type: List<BlockPredicate>
- The collection of predicates to test for showInTooltip: bool (optional) Type: bool
- Whether to show the ability in the tooltip or not.
Default Value: true
Return Type:
ComponentAccess
AdventureModePredicateReturns: The new instance with the modified data.
myIItemStack.withCanBreak(myAdventureModePredicate);Parameters:
predicate: AdventureModePredicate Type: AdventureModePredicate
- The adventure mode predicate to use to determine whether the item can be used to break a block.
Return Type:
ComponentAccess
Any predicate that matches will allow the BlockItem within the ItemStack to be placed.
Returns: The new instance with the modified data.
// IItemStack.withCanPlaceOn(predicates as List<BlockPredicate>, showInTooltip as bool = true) as ComponentAccess;myIItemStack.withCanPlaceOn(BlockPredicate.create().of(<block:minecraft:dirt>).build(), myBool);Parameters:
predicates: List<BlockPredicate> Type: List<BlockPredicate>
- The collection of predicates to test for showInTooltip: bool (optional) Type: bool
- Whether to show the restriction in the tooltip or not.
Default Value: true
Return Type:
ComponentAccess
AdventureModePredicateReturns: The new instance with the modified data.
myIItemStack.withCanPlaceOn(myAdventureModePredicate);Parameters:
predicate: AdventureModePredicate Type: AdventureModePredicate
- The adventure mode predicate to use to determine whether the current block can be placed on another block.
Return Type:
ComponentAccess
IItemStackReturns: The new instance with the modified data.
myIItemStack.withChargedProjectiles(<item:minecraft:arrow>);Parameters:
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withChargedProjectiles([<item:minecraft:arrow>]);Parameters:
Return Type:
ComponentAccess
ChargedProjectilesReturns: The new instance with the modified data.
myIItemStack.withChargedProjectiles(myChargedProjectiles);Parameters:
chargedProjectiles: ChargedProjectiles Type: ChargedProjectiles
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withContainer(myList);Parameters:
contents: List<IItemStack> Type: List<IItemStack>
Return Type:
ComponentAccess
ItemContainerContentsReturns: The new instance with the modified data.
myIItemStack.withContainer(myItemContainerContents);Parameters:
contents: ItemContainerContents Type: ItemContainerContents
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// IItemStack.withContainerLoot(lootTable as ResourceKey<LootTable>, seed as long) as ComponentAccess;myIItemStack.withContainerLoot(myResourceKey, myLong);Parameters:
lootTable: ResourceKey<LootTable> Type: ResourceKey<LootTable> seed: long Type: long
Return Type:
ComponentAccess
SeededContainerLootReturns: The new instance with the modified data.
myIItemStack.withContainerLoot(mySeededContainerLoot);Parameters:
loot: SeededContainerLoot Type: SeededContainerLoot
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withCreativeSlotLock();
Return Type:
ComponentAccess
MapDataReturns: The new instance with the modified data.
myIItemStack.withCustomData({custom_ammo_thing: 1, owner: "Benji"});
Return Type:
ComponentAccess
CustomDataReturns: The new instance with the modified data.
myIItemStack.withCustomData(myCustomData);Parameters:
customData: CustomData Type: CustomData
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withCustomModelData(2);Parameters:
value: int Type: int
- The value to set the CustomModelData to
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withCustomModelData(myCustomModelData);Parameters:
data: CustomModelData Type: CustomModelData
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withCustomName(Component.literal("Fancy Water"));
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withDamage(16);Parameters:
damage: int Type: int
- The new damage of the ComponentAccess.
Return Type:
ComponentAccess
DebugStickStateReturns: The new instance with the modified data.
myIItemStack.withDebugStickState(myDebugStickState);Parameters:
state: DebugStickState Type: DebugStickState
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withDyedColor(0xFFFF00, true);Parameters:
rgb: int Type: int
- The colour to dye this item with showInTooltip: bool (optional) Type: bool
- Whether to show this information in a tooltip
Default Value: true
Return Type:
ComponentAccess
DyedItemColorReturns: The new instance with the modified data.
myIItemStack.withDyedColor(myDyedItemColor);Parameters:
color: DyedItemColor Type: DyedItemColor
Return Type:
ComponentAccess
Enchantment and level.Returns: The new instance with the modified data.
myIItemStack.withEnchantment(<enchantment:minecraft:efficiency>, 4);Parameters:
level: int (optional) Type: int
- The level of the enchantment to set
Default Value: 1
Return Type:
ComponentAccess
If it is false, the item will never render the enchantment glint If it is true, the item will render the enchantment glint always, indenpendently of whether it is enchanted or not.
Returns: The new instance with the modified data.
myIItemStack.withEnchantmentGlintOverride(true);Parameters:
value: bool Type: bool
- The value of the override, as described above
Return Type:
ComponentAccess
ItemEnchantmentsReturns: The new instance with the modified data.
myIItemStack.withEnchantments(myItemEnchantments);Parameters:
enchantments: ItemEnchantments Type: ItemEnchantments
Return Type:
ComponentAccess
MapDataReturns: The new instance with the modified data.
myIItemStack.withEntityData(myMapData);
Return Type:
ComponentAccess
CustomDataReturns: The new instance with the modified data.
myIItemStack.withEntityData(myCustomData);Parameters:
data: CustomData Type: CustomData
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withFireResistant();
Return Type:
ComponentAccess
FireworkExplosionReturns: The new instance with the modified data.
myIItemStack.withFireworkExplosion(myFireworkExplosion);Parameters:
explosion: FireworkExplosion Type: FireworkExplosion
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// IItemStack.withFireworks(flightDuration as int, explosions as List<FireworkExplosion>) as ComponentAccess;myIItemStack.withFireworks(myInt, myList);Parameters:
flightDuration: int Type: int explosions: List<FireworkExplosion> Type: List<FireworkExplosion>
Return Type:
ComponentAccess
FireworksReturns: The new instance with the modified data.
myIItemStack.withFireworks(myFireworks);
Return Type:
ComponentAccess
FoodPropertiesReturns: The new instance with the modified data.
myIItemStack.withFood(myFoodProperties);Parameters:
food: FoodProperties Type: FoodProperties
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withHideAdditionalTooltip();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withHideTooltip();
Return Type:
ComponentAccess
InstrumentReturns: The new instance with the modified data.
myIItemStack.withInstrument(myInstrument);Parameters:
instrument: Instrument Type: Instrument
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withIntangibleProjectile();
Return Type:
ComponentAccess
ComponentReturns: The new instance with the modified data.
myIItemStack.withItemName(Component.literal("Fancy Water"));
Return Type:
ComponentAccess
myIItemStack.withJsonComponent(myDataComponentType, myIData);Parameters:
type: DataComponentType<T> Type: DataComponentType<T>
Return Type:
IItemStack
myIItemStack.withJsonComponents(myIData);
Return Type:
IItemStack
Returns: The new instance with the modified data.
myIItemStack.withLock(myString);Parameters:
code: string Type: string
Return Type:
ComponentAccess
LockCodeReturns: The new instance with the modified data.
myIItemStack.withLock(myLockCode);
Return Type:
ComponentAccess
LodestoneTrackerReturns: The new instance with the modified data.
myIItemStack.withLodestoneTracker(myLodestoneTracker);Parameters:
tracker: LodestoneTracker Type: LodestoneTracker
Return Type:
ComponentAccess
Component>Returns: The new instance with the modified data.
myIItemStack.withLore([Component.literal("Found in a dark cave"), Component.translatable("Belonged to a Dragon")]);Parameters:
Return Type:
ComponentAccess
myIItemStack.withLore(myComponent);
Return Type:
ComponentAccess
ItemLoreReturns: The new instance with the modified data.
myIItemStack.withLore(myItemLore);
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withMapColor(0xFF0000);Parameters:
rgb: int Type: int
- The new map colour
Return Type:
ComponentAccess
MapItemColorReturns: The new instance with the modified data.
myIItemStack.withMapColor(myMapItemColor);Parameters:
color: MapItemColor Type: MapItemColor
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withMapDecorations(myMap);Parameters:
decorations: MapDecorationsEntry[string] Type: MapDecorationsEntry[string]
Return Type:
ComponentAccess
MapDecorationsReturns: The new instance with the modified data.
myIItemStack.withMapDecorations(myMapDecorations);Parameters:
decorations: MapDecorations Type: MapDecorations
Return Type:
ComponentAccess
A map id is only useful after the game generates one to store data. Therefore, you should always pass in the parameter for an id you know is available.
Returns: The new instance with the modified data.
myIItemStack.withMapId(myInt);Parameters:
id: int Type: int
Return Type:
ComponentAccess
MapIdReturns: The new instance with the modified data.
myIItemStack.withMapId(myMapId);
Return Type:
ComponentAccess
MapPostProcessingReturns: The new instance with the modified data.
myIItemStack.withMapPostProcessing(myMapPostProcessing);Parameters:
value: MapPostProcessing Type: MapPostProcessing
Return Type:
ComponentAccess
It is likely that you need to call withDamage(0) in order for some things to function properly.
Returns: The new instance with the modified data.
myIItemStack.withMaxDamage(1024);Parameters:
maxDamage: int Type: int
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withMaxStackSize(16);Parameters:
maxStackSize: int Type: int
- The new maxStackSize of the ComponentAccess.
Return Type:
ComponentAccess
ResourceLocationReturns: The new instance with the modified data.
myIItemStack.withNoteBlockSound(myResourceLocation);Parameters:
sound: ResourceLocation Type: ResourceLocation
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withOminousBottleAmplifier(myInt);Parameters:
amplifier: int Type: int
Return Type:
ComponentAccess
myIItemStack.without<T>(myDataComponentType);Parameters:
type: DataComponentType<T> Type: DataComponentType<T>
Return Type:
IItemStack
Returns: The new instance with the modified data.
myIItemStack.withoutAttributeModifiers();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutBannerPatterns();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutBaseColor();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutBees();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutBlockEntityData();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutBlockState();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutBucketEntityData();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutBundleContents();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutCanBreak();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutCanPlaceOn();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutChargedProjectiles();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutContainer();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutContainerLoot();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutCreativeSlotLock();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutCustomData();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutCustomModelData();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutCustomName();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutDamage();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutDebugStickState();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutDyedColor();
Return Type:
ComponentAccess
Enchantment from the ComponentAccess.Returns: The new instance with the modified data.
myIItemStack.withoutEnchantment(<enchantment:minecraft:mending>);Parameters:
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutEnchantmentGlintOverride();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutEnchantments();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutEntityDate();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutFireResistant();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutFireworkExplosion();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutFireworks();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutFood();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutHideAdditionalTooltip();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutHideTooltip();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutInstrument();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutIntangibleProjectile();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutItemName();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutLock();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutLodestoneTracker();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutLore();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutMapColor();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutMapDecorations();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutMapId();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutMapPostProcessing();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutMaxDamage();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutMaxStackSize();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutNoteBlockSound();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutOminousBottleAmplifier();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutPotDecorations();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutPotionContents();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutProfile();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutRarity();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutRecipes();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutRepairCost();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutStoredEnchantments();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutSuspiciousStewEffects();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutTool();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutTrim();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutUnbreakable();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutWritableBookContent();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withoutWrittenBookContent();
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
// IItemStack.withPotDecorations(back as ItemDefinition, left as ItemDefinition, right as ItemDefinition, front as ItemDefinition) as ComponentAccess;myIItemStack.withPotDecorations(myItem, myItem, myItem, myItem);Parameters:
back: ItemDefinition Type: ItemDefinition left: ItemDefinition Type: ItemDefinition right: ItemDefinition Type: ItemDefinition front: ItemDefinition Type: ItemDefinition
Return Type:
ComponentAccess
PotDecorationsReturns: The new instance with the modified data.
myIItemStack.withPotDecorations(myPotDecorations);Parameters:
decorations: PotDecorations Type: PotDecorations
Return Type:
ComponentAccess
Potionand no custom effects
Returns: The new instance with the modified data.
myIItemStack.withPotionContents(<potion:minecraft:swiftness>);
Return Type:
ComponentAccess
Potionand the given
MobEffectInstance effects.Returns: The new instance with the modified data.
// IItemStack.withPotionContents(potion as Potion, customEffects as List<MobEffectInstance>) as ComponentAccess;myIItemStack.withPotionContents(<potion:minecraft:swiftness>, [MobEffectInstance.of(<mobeffect:minecraft:strength>, 20 * 20, 1, false, false, true)]);Parameters:
customEffects: List<MobEffectInstance> Type: List<MobEffectInstance>
- The effects to grant upon consuming this potion.
Return Type:
ComponentAccess
Potionand the given
MobEffectInstance effects.Returns: The new instance with the modified data.
// IItemStack.withPotionContents(potion as Potion, customColor as int, customEffects as List<MobEffectInstance>) as ComponentAccess;myIItemStack.withPotionContents(<potion:minecraft:swiftness>, 0xFFFFFF00, [MobEffectInstance.of(<mobeffect:minecraft:strength>, 20 * 20, 1, false, false, true)]);Parameters:
customColor: int Type: int
- The ARGB color the potion will have. customEffects: List<MobEffectInstance> Type: List<MobEffectInstance>
- The effects to grant upon consuming this potion.
Return Type:
ComponentAccess
PotionContentsReturns: The new instance with the modified data.
myIItemStack.withPotionContents(myPotionContents);Parameters:
contents: PotionContents Type: PotionContents
Return Type:
ComponentAccess
ResolvableProfileReturns: The new instance with the modified data.
myIItemStack.withProfile(myResolvableProfile);Parameters:
profile: ResolvableProfile Type: ResolvableProfile
Return Type:
ComponentAccess
RarityReturns: The new instance with the modified data.
myIItemStack.withRarity(<constant:minecraft:item/rarity:epic>);
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withRecipes(myList);Parameters:
recipes: List<ResourceLocation> Type: List<ResourceLocation>
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withRepairCost(20);Parameters:
cost: int Type: int
- The repair cost
Return Type:
ComponentAccess
ItemEnchantmentsReturns: The new instance with the modified data.
myIItemStack.withStoredEnchantments(myItemEnchantments);Parameters:
enchantments: ItemEnchantments Type: ItemEnchantments
Return Type:
ComponentAccess
SuspiciousStewEffectsSuspiciousStewEffects.Entry is effectively a pair of Effect and duration.
Returns: The new instance with the modified data.
// IItemStack.withSuspiciousStewEffects(effects as List<SuspiciousStewEffectsEntry>) as ComponentAccess;myIItemStack.withSuspiciousStewEffects(myList);Parameters:
effects: List<SuspiciousStewEffectsEntry> Type: List<SuspiciousStewEffectsEntry>
- The list of effects to grant on consumption.
Return Type:
ComponentAccess
SuspiciousStewEffectsReturns: The new instance with the modified data.
// IItemStack.withSuspiciousStewEffects(suspiciousStewEffects as SuspiciousStewEffects) as ComponentAccess;myIItemStack.withSuspiciousStewEffects(mySuspiciousStewEffects);Parameters:
suspiciousStewEffects: SuspiciousStewEffects Type: SuspiciousStewEffects
Return Type:
ComponentAccess
Tool instance is constructed from the parameters.Returns: The new instance with the modified data.
// IItemStack.withTool(rules as List<ToolRule>, defaultMiningSpeed as float, damagePerBlock as int) as ComponentAccess;myIItemStack.withTool([ToolRule.minesAndDrops(<tag:blocks:minecraft:planks>, 6.0f)], 0.25f, 1);Parameters:
Return Type:
ComponentAccess
ToolReturns: The new instance with the modified data.
myIItemStack.withTool(myTool);
Return Type:
ComponentAccess
ArmorTrimReturns: The new instance with the modified data.
myIItemStack.withTrim(myArmorTrim);
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withUnbreakable(myBool);Parameters:
showInTooltip: bool (optional) Type: bool
- Whether to show that the ComponentAccess is unbreakable in a tooltip.
Default Value: true
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withUnbreakable(myUnbreakable);Parameters:
Return Type:
ComponentAccess
Returns: The new instance with the modified data.
myIItemStack.withWritableBookContent(myList);Parameters:
pages: List<Filterable<string>> Type: List<Filterable<string>>
Return Type:
ComponentAccess
WritableBookContentReturns: The new instance with the modified data.
myIItemStack.withWritableBookContent(myWritableBookContent);Parameters:
content: WritableBookContent Type: WritableBookContent
Return Type:
ComponentAccess
WrittenBookContentReturns: The new instance with the modified data.
myIItemStack.withWrittenBookContent(myWrittenBookContent);Parameters:
content: WrittenBookContent Type: WrittenBookContent
Return Type:
ComponentAccess
// IItemStack.writableBookContent as WritableBookContentmyIItemStack.writableBookContent
Return Type:
WritableBookContent
// IItemStack.writtenBookContent as WrittenBookContentmyIItemStack.writtenBookContent
Return Type:
WrittenBookContent