Home Commands Examples Getting Started With Scripts Global Keywords 1.21 Migration Guide
Equipable IItemStack ItemCooldowns ItemDefinition ItemStack UseOnContext
BracketDumpers BracketHandlers BracketValidators ResourceLocationBracketHandler

BlockItem

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.

script.zs
import crafttweaker.api.item.type.block.BlockItem;

Extends

BlockItem extends ItemDefinition.

Implements

BlockItem implements the following interfaces:

ItemLike

Undocumented Interfaces

FeatureElement,IItemExtension

Members

addAttributeModifier(attribute as Attribute, modifier as AttributeModifier, slot as EquipmentSlotGroup)
script.zs
// BlockItem.addAttributeModifier(attribute as Attribute, modifier as AttributeModifier, slot as EquipmentSlotGroup);
myBlockItem.addAttributeModifier(myAttribute, myAttributeModifier, myEquipmentSlotGroup);

Parameters:

addEnchantment(enchantment as Enchantment, level as int)
script.zs
// BlockItem.addEnchantment(enchantment as Enchantment, level as int);
myBlockItem.addEnchantment(myEnchantment, myInt);

Parameters:

enchantment Type: Enchantment
level Type: int
asItem() as Item
script.zs
// BlockItem.asItem() as Item;
myBlockItem.asItem();

Return Type: ItemDefinition

as Item
script.zs
// BlockItem as Item
myBlockItem as Item

Return Type: ItemDefinition

Setter
script.zs
// BlockItem.attributeModifiers = (modifiers as ItemAttributeModifiers);
myBlockItem.attributeModifiers = myItemAttributeModifiers;

Parameters:

Setter
script.zs
// BlockItem.bannerPatterns = (patterns as BannerPatternLayers);
myBlockItem.bannerPatterns = myBannerPatternLayers;

Parameters:

Setter
script.zs
// BlockItem.baseColor = (baseColor as DyeColor);
myBlockItem.baseColor = myDyeColor;

Parameters:

baseColor Type: DyeColor
Setter
script.zs
// BlockItem.bees = (occupants as List<Occupant>);
myBlockItem.bees = myList;

Parameters:

Getter
script.zs
// BlockItem.block as Block
myBlockItem.block

Return Type: Block

block() as Block
script.zs
// BlockItem.block() as Block;
myBlockItem.block();

Return Type: Block

as Block
script.zs
// BlockItem as Block
myBlockItem as Block

Return Type: Block

Setter
script.zs
// BlockItem.blockEntityData = (data as CustomData);
myBlockItem.blockEntityData = myCustomData;

Parameters:

data Type: CustomData
Setter
script.zs
// BlockItem.blockState = (blockState as BlockItemStateProperties);
myBlockItem.blockState = myBlockItemStateProperties;

Parameters:

Setter
script.zs
// BlockItem.bucketEntityData = (data as CustomData);
myBlockItem.bucketEntityData = myCustomData;

Parameters:

data Type: CustomData
Setter
script.zs
// BlockItem.bundleContents = (bundleContents as BundleContents);
myBlockItem.bundleContents = myBundleContents;

Parameters:

bundleContents Type: BundleContents
Setter
script.zs
// BlockItem.canBreak = (predicate as AdventureModePredicate);
myBlockItem.canBreak = myAdventureModePredicate;

Parameters:

Setter
script.zs
// BlockItem.canPlaceOn = (predicate as AdventureModePredicate);
myBlockItem.canPlaceOn = myAdventureModePredicate;

Parameters:

Setter
script.zs
// BlockItem.chargedProjectiles = (chargedProjectiles as ChargedProjectiles);
myBlockItem.chargedProjectiles = myChargedProjectiles;

Parameters:

chargedProjectiles Type: ChargedProjectiles
Getter
script.zs
// BlockItem.commandString as string
myBlockItem.commandString

Return Type: string

commandString() as string
script.zs
// BlockItem.commandString() as string;
myBlockItem.commandString();

Return Type: string

static commonItemComponents() as DataComponentMap
script.zs
// BlockItem.commonItemComponents() as DataComponentMap;
BlockItem.commonItemComponents();

Return Type: DataComponentMap

Setter
script.zs
// BlockItem.container = (container as ItemContainerContents);
myBlockItem.container = myItemContainerContents;

Parameters:

Setter
script.zs
// BlockItem.containerLoot = (containerLoot as SeededContainerLoot);
myBlockItem.containerLoot = mySeededContainerLoot;

Parameters:

Setter
script.zs
// BlockItem.creativeSlotLock = (creativeSlotLock as bool);
myBlockItem.creativeSlotLock = myBool;

Parameters:

creativeSlotLock Type: bool
Setter
script.zs
// BlockItem.customData = (customData as CustomData);
myBlockItem.customData = myCustomData;

Parameters:

customData Type: CustomData
Setter
script.zs
// BlockItem.customModelData = (modelData as CustomModelData);
myBlockItem.customModelData = myCustomModelData;

Parameters:

modelData Type: CustomModelData
Setter
script.zs
// BlockItem.customName = (component as Component);
myBlockItem.customName = myComponent;

Parameters:

component Type: Component
Setter
script.zs
// BlockItem.debugStickState = (debugStickState as DebugStickState);
myBlockItem.debugStickState = myDebugStickState;

Parameters:

debugStickState Type: DebugStickState
Getter
script.zs
// BlockItem.defaultInstance as IItemStack
myBlockItem.defaultInstance

Return Type: IItemStack

defaultInstance() as IItemStack
script.zs
// BlockItem.defaultInstance() as IItemStack;
myBlockItem.defaultInstance();

Return Type: IItemStack

implicit as IItemStack
script.zs
// BlockItem as IItemStack
myBlockItem as IItemStack

Return Type: IItemStack

Setter
script.zs
// BlockItem.dyedColor = (color as DyedItemColor);
myBlockItem.dyedColor = myDyedItemColor;

Parameters:

Setter
script.zs
// BlockItem.enchantmentGlintOverride = (value as bool);
myBlockItem.enchantmentGlintOverride = myBool;

Parameters:

value Type: bool
Setter
script.zs
// BlockItem.enchantments = (enchantments as ItemEnchantments);
myBlockItem.enchantments = myItemEnchantments;

Parameters:

enchantments Type: ItemEnchantments
Setter
script.zs
// BlockItem.entityData = (data as CustomData);
myBlockItem.entityData = myCustomData;

Parameters:

data Type: CustomData
Setter
script.zs
// BlockItem.fireResistant = (intangibleProjectile as bool);
myBlockItem.fireResistant = myBool;

Parameters:

intangibleProjectile Type: bool
Setter
script.zs
// BlockItem.fireworkExplosion = (explosion as FireworkExplosion);
myBlockItem.fireworkExplosion = myFireworkExplosion;

Parameters:

Setter
script.zs
// BlockItem.fireworks = (fireworks as Fireworks);
myBlockItem.fireworks = myFireworks;

Parameters:

fireworks Type: Fireworks
Setter
script.zs
// BlockItem.food = (food as FoodProperties);
myBlockItem.food = myFoodProperties;

Parameters:

Setter
script.zs
// BlockItem.hideAdditionalTooltip = (hideAdditionalTooltip as bool);
myBlockItem.hideAdditionalTooltip = myBool;

Parameters:

hideAdditionalTooltip Type: bool
Setter
script.zs
// BlockItem.hideTooltip = (hideTooltip as bool);
myBlockItem.hideTooltip = myBool;

Parameters:

hideTooltip Type: bool
Setter
script.zs
// BlockItem.instrument = (instrument as Instrument);
myBlockItem.instrument = myInstrument;

Parameters:

instrument Type: Instrument
Setter
script.zs
// BlockItem.intangibleProjectile = (intangibleProjectile as bool);
myBlockItem.intangibleProjectile = myBool;

Parameters:

intangibleProjectile Type: bool
Setter
script.zs
// BlockItem.itemName = (component as Component);
myBlockItem.itemName = myComponent;

Parameters:

component Type: Component
Setter
script.zs
// BlockItem.lockCode = (code as LockCode);
myBlockItem.lockCode = myLockCode;

Parameters:

code Type: LockCode
Setter
script.zs
// BlockItem.lodestoneTracker = (tracker as LodestoneTracker);
myBlockItem.lodestoneTracker = myLodestoneTracker;

Parameters:

Setter
script.zs
// BlockItem.lore = (lore as ItemLore);
myBlockItem.lore = myItemLore;

Parameters:

lore Type: ItemLore
Setter
script.zs
// BlockItem.mapColor = (mapColor as MapItemColor);
myBlockItem.mapColor = myMapItemColor;

Parameters:

mapColor Type: MapItemColor
Setter
script.zs
// BlockItem.mapDecorations = (mapDecorations as MapDecorations);
myBlockItem.mapDecorations = myMapDecorations;

Parameters:

mapDecorations Type: MapDecorations
Setter
script.zs
// BlockItem.mapId = (id as MapId);
myBlockItem.mapId = myMapId;

Parameters:

id Type: MapId
Setter
script.zs
// BlockItem.mapPostProcessing = (mapPostProcessing as MapPostProcessing);
myBlockItem.mapPostProcessing = myMapPostProcessing;

Parameters:

mapPostProcessing Type: MapPostProcessing
Setter
script.zs
// BlockItem.maxDamage = (maxDamage as int);
myBlockItem.maxDamage = myInt;

Parameters:

maxDamage Type: int
Setter
script.zs
// BlockItem.maxStackSize = (maxStackSize as int);
myBlockItem.maxStackSize = myInt;

Parameters:

maxStackSize Type: int
Setter
script.zs
// BlockItem.noteBlockSound = (sound as ResourceLocation);
myBlockItem.noteBlockSound = myResourceLocation;

Parameters:

Setter
script.zs
// BlockItem.ominousBottleAmplifier = (amplifier as int);
myBlockItem.ominousBottleAmplifier = myInt;

Parameters:

amplifier Type: int
Setter
script.zs
// BlockItem.potDecorations = (decorations as PotDecorations);
myBlockItem.potDecorations = myPotDecorations;

Parameters:

decorations Type: PotDecorations
Setter
script.zs
// BlockItem.potionContents = (potionContents as PotionContents);
myBlockItem.potionContents = myPotionContents;

Parameters:

potionContents Type: PotionContents
Setter
script.zs
// BlockItem.profile = (profile as ResolvableProfile);
myBlockItem.profile = myResolvableProfile;

Parameters:

Setter
script.zs
// BlockItem.rarity = (rarity as Rarity);
myBlockItem.rarity = myRarity;

Parameters:

rarity Type: Rarity
Setter
script.zs
// BlockItem.recipes = (recipes as List<ResourceLocation>);
myBlockItem.recipes = myList;

Parameters:

recipes Type: List<ResourceLocation>
Getter
script.zs
// BlockItem.registryName as ResourceLocation
myBlockItem.registryName

Return Type: ResourceLocation

registryName() as ResourceLocation
script.zs
// BlockItem.registryName() as ResourceLocation;
myBlockItem.registryName();

Return Type: ResourceLocation

remove(type as DataComponentType<T>)
script.zs
// BlockItem.remove(type as DataComponentType<T>);
myBlockItem.remove(myDataComponentType);

Parameters:

Setter
script.zs
// BlockItem.repairCost = (cost as int);
myBlockItem.repairCost = myInt;

Parameters:

cost Type: int
setComponent(type as DataComponentType<T>, value as T)
script.zs
// BlockItem.setComponent<T>(type as DataComponentType<T>, value as T);
myBlockItem.setComponent<T>(myDataComponentType, myT);

Parameters:

value Type: T
setJsonComponent(type as DataComponentType<T>, value as IData)
script.zs
// BlockItem.setJsonComponent(type as DataComponentType<T>, value as IData);
myBlockItem.setJsonComponent(myDataComponentType, myIData);

Parameters:

value Type: IData
Setter
script.zs
// BlockItem.storedEnchantments = (storedEnchantments as ItemEnchantments);
myBlockItem.storedEnchantments = myItemEnchantments;

Parameters:

storedEnchantments Type: ItemEnchantments
Setter
script.zs
// BlockItem.suspiciousStewEffects = (suspiciousStewEffects as SuspiciousStewEffects);
myBlockItem.suspiciousStewEffects = mySuspiciousStewEffects;

Parameters:

suspiciousStewEffects Type: SuspiciousStewEffects
Setter
script.zs
// BlockItem.tool = (tool as Tool);
myBlockItem.tool = myTool;

Parameters:

tool Type: Tool
Setter
script.zs
// BlockItem.trim = (trim as ArmorTrim);
myBlockItem.trim = myArmorTrim;

Parameters:

trim Type: ArmorTrim
Setter
script.zs
// BlockItem.unbreakable = (unbreakable as Unbreakable);
myBlockItem.unbreakable = myUnbreakable;

Parameters:

unbreakable Type: Unbreakable
Setter
script.zs
// BlockItem.writableBookContent = (writableBookContent as WritableBookContent);
myBlockItem.writableBookContent = myWritableBookContent;

Parameters:

writableBookContent Type: WritableBookContent
Setter
script.zs
// BlockItem.writtenBookContent = (writtenBookContent as WrittenBookContent);
myBlockItem.writtenBookContent = myWrittenBookContent;

Parameters:

writtenBookContent Type: WrittenBookContent