Importing the class

Link to importing-the-class

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

ZenScript
Copy
import crafttweaker.api.item.ItemDefinition;

Implemented Interfaces

Link to implemented-interfaces

ItemDefinition implements the following interfaces. That means all methods defined in these interfaces are also available in ItemDefinition

Link to commonItemComponents

Name: commonItemComponents

Return Type: DataComponentMap

ZenScript
Copy
// ItemDefinition.commonItemComponents() as DataComponentMap

ItemDefinition.commonItemComponents();
Result TypeIs Implicit
Result Type
IItemStack
Is Implicit
true

Link to addAttributeModifier

Name: addAttributeModifier

ZenScript
Copy
ItemDefinition.addAttributeModifier(attribute as Attribute, modifier as AttributeModifier, slot as EquipmentSlotGroup)
ParameterType
Parameter
attribute
Type
Attribute
Parameter
modifier
Type
AttributeModifier
Parameter
slot
Type
EquipmentSlotGroup

Name: addEnchantment

ZenScript
Copy
ItemDefinition.addEnchantment(enchantment as Enchantment, level as int)
ParameterType
Parameter
enchantment
Type
Enchantment
Parameter
level
Type
int

Link to getCommandString

Name: getCommandString

Return Type: string

ZenScript
Copy
// ItemDefinition.getCommandString() as string

myItemDefinition.getCommandString();

Link to getDefaultInstance

Name: getDefaultInstance

Return Type: IItemStack

ZenScript
Copy
// ItemDefinition.getDefaultInstance() as IItemStack

myItemDefinition.getDefaultInstance();

Name: getRegistryName

Return Type: ResourceLocation

ZenScript
Copy
// ItemDefinition.getRegistryName() as ResourceLocation

myItemDefinition.getRegistryName();

Name: remove

ZenScript
Copy
ItemDefinition.remove(type as DataComponentType)
ParameterType
Parameter
type
Type
DataComponentType

Name: setComponent

ZenScript
Copy
ItemDefinition.setComponent<T : Object>(type as DataComponentType<T>, value as T)
ParameterType
Parameter
type
Type
DataComponentType<T>
Parameter
value
Type
T
Parameter
T
Type
Object

Link to setJsonComponent

Name: setJsonComponent

ZenScript
Copy
ItemDefinition.setJsonComponent(type as DataComponentType, value as IData?)
ParameterType
Parameter
type
Type
DataComponentType
Parameter
value
Type
IData?
NameTypeHas GetterHas Setter
Name
attributeModifiers
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
bannerPatterns
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
baseColor
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
bees
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
blockEntityData
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
blockState
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
bucketEntityData
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
bundleContents
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
canBreak
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
canPlaceOn
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
chargedProjectiles
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
commandString
Type
string
Has Getter
true
Has Setter
false
Name
container
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
containerLoot
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
creativeSlotLock
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
customData
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
customModelData
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
customName
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
debugStickState
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
defaultInstance
Type
IItemStack
Has Getter
true
Has Setter
false
Name
dyedColor
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
enchantmentGlintOverride
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
enchantments
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
entityData
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
fireResistant
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
fireworkExplosion
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
fireworks
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
food
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
hideAdditionalTooltip
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
hideTooltip
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
instrument
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
intangibleProjectile
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
itemName
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
lockCode
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
lodestoneTracker
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
lore
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
mapColor
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
mapDecorations
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
mapId
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
mapPostProcessing
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
maxDamage
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
maxStackSize
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
noteBlockSound
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
ominousBottleAmplifier
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
potDecorations
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
potionContents
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
profile
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
rarity
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
recipes
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
registryName
Type
ResourceLocation
Has Getter
true
Has Setter
false
Name
repairCost
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
storedEnchantments
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
suspiciousStewEffects
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
tool
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
trim
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
unbreakable
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
writableBookContent
Type
ItemDefinition
Has Getter
false
Has Setter
true
Name
writtenBookContent
Type
ItemDefinition
Has Getter
false
Has Setter
true