Items - Components Module
anvil.api.items.components
ItemAllowOffHand
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(value)
Determines whether an item can be placed in the off-hand slot of the inventory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
Whether the item can be placed in the off-hand slot. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_allow_off_hand
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemBlockPlacer
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(block, replace_block_item=False)
Sets the item as a Planter item component for blocks. Planter items are items that can be planted into another block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block
|
str
|
Set the placement block name for the planter item. |
required |
use_on
|
str
|
List of block descriptors that contain blocks that this item can be used on. If left empty, all blocks will be allowed. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_block_placer
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
use_on(*blocks)
List of block descriptors that contain blocks that this item can be used on.
ItemBundleInteraction
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(num_viewable_slots=12)
Specifies the number of slots in the bundle viewable by the player.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_viewable_slots
|
int
|
The maximum number of slots in the bundle viewable by the player. Can be from 1 to 64. Default is 12. Value must be >= 1 and <= 64. |
12
|
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_bundle_interaction
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemCanDestroyInCreative
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(value)
Determines if an item will break blocks in Creative Mode while swinging.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
If an item will break blocks in Creative Mode while swinging. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_can_destroy_in_creative
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemCompostable
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(composting_chance)
Specifies that an item is compostable and provides the chance of creating a composting layer in the composter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
composting_chance
|
float
|
The chance of this item to create a layer upon composting with the composter. Valid value range is 1 - 100 inclusive Value must be >= 1. Value must be <= 100. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_compostable
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemCooldown
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(category, duration)
Sets an items "Cool down" time. After using an item, it becomes unusable for the duration specified by the 'duration' setting of this component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
category
|
str
|
The type of cool down for this item. |
required |
duration
|
float
|
The duration of time (in Seconds) items with a matching category will spend cooling down before becoming usable again. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_cooldown
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemCustomComponents
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(component_name)
Allows you to add custom components to an item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
components
|
str
|
The components to register, if the namespace is not provided, the project namespace will be used. |
required |
Documentation reference:
https://learn.microsoft.com/en-us/minecraft/creator/documents/scripting/custom-components
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemDamage
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(value)
Determines how much extra damage an item does on attack.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
How much extra damage the item does on attack. Note that this must be a positive value. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_damage
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemDamageAbsorption
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(absorbable_causes)
Allows an item to absorb damage that would otherwise be dealt to its wearer. For this to happen, the item needs to be equipped in an armor slot. The absorbed damage reduces the item's durability, with any excess damage being ignored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
absorbable_causes
|
str
|
List of damage causes that can be absorbed by the item. Must have at least 1 item. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_damage_absorption
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemDigger
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(destroy_speeds)
Sets the item as a "Digger" item. Component put on items that dig.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
destroy_speeds
|
str
|
Destroy speed per block. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_digger
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
use_efficiency(use_efficiency=False)
Toggles if the item will be used efficiently.
ItemDisplayName
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(display_name, localized_key=None)
Sets the item display name within Minecraft: Bedrock Edition. This component may also be used to pull from the localization file by referencing a key from it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
display_name
|
str
|
Set the display name for an item. |
required |
key
|
str
|
The localization key for the display name. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_display_name
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemDurability
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(max_durability, damage_chance=100)
Sets how much damage the item can take before breaking, and allows the item to be combined at an anvil, grindstone, or crafting table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_durability
|
int
|
Max durability is the amount of damage that this item can take before breaking. The minimum value for this parameter is 0. |
required |
damage_chance
|
int
|
Damage chance is the percentage chance of this item losing durability. Default is set at 100 to 100.. Defaults to 100. |
100
|
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_durability
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemEnchantable
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(slot, value)
Determines what enchantments can be applied to the item. Not all enchantments will have an effect on all item components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
type
|
str
|
What enchantments can be applied (ex. Using bow would allow this item to be enchanted as if it were a bow). |
required |
value
|
int
|
The value of the enchantment (minimum of 0). |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_enchantable
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemEntityPlacer
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(entity)
Allows an item to place entities into the world. Additionally, the component allows the item to set the spawn type of a monster spawner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity
|
str
|
The entity to be placed in the world. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_entity_placer
__iter__()
Iterates over the component's fields.
dispense_on(*blocks)
List of block descriptors that contain blocks that this item can be dispensed on.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
use_on(*blocks)
List of block descriptors that contain blocks that this item can be used on.
ItemFireResistant
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(value=True)
Determines whether the item is immune to burning when dropped in fire or lava.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
Determines whether the item is immune to burning when dropped in fire or lava. Defaults to True. |
True
|
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_fire_resistant
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemFood
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(can_always_eat=False, nutrition=0, saturation_modifier=0, using_converts_to=None)
Sets the item as a food component, allowing it to be edible to the player.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
can_always_eat
|
bool
|
If true you can always eat this item (even when not hungry). |
False
|
nutrition
|
int
|
The value that is added to the actor's nutrition when the item is used. Defaults to 0. |
0
|
saturation_modifier
|
float
|
Saturation Modifier is used in this formula: (nutrition saturation_modifier 2) when applying the saturation buff. Defaults to 0. |
0
|
using_converts_to
|
str
|
Saturation Modifier is used in this formula: (nutrition saturation_modifier 2) when applying the saturation buff. Defaults to None. |
None
|
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_food
__iter__()
Iterates over the component's fields.
effects(effect, chance, duration, amplifier)
DEPRECATED
Sets the effects of the food item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
effect
|
Effects
|
The effect to apply. |
required |
chance
|
float
|
The chance of the effect being applied. |
required |
duration
|
Seconds
|
The duration of the effect. |
required |
amplifier
|
int
|
The amplifier of the effect. |
required |
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemFuel
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(duration)
Allows this item to be used as fuel in a furnace to 'cook' other items.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration
|
float
|
How long in seconds will this fuel cook items for. Minimum value: 0.05. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_fuel
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemGlint
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(value)
Determines whether the item has the enchanted glint render effect on it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
Whether the item has the enchanted glint render effect. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_glint
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemHandEquipped
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(value)
Determines if an item is rendered like a tool while in-hand.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
Determines if the item is rendered like a tool in-hand. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_hand_equipped
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemHoverTextColor
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(color)
Determines the color of the item name when hovering over it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
The color of the item name when hovering over it. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_hover_text_color
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemIcon
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(texture)
Sets the icon item component. Determines the icon to represent the item in the UI and elsewhere.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
texture
|
str
|
The item texture name to be used. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_icon
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemInteractButton
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(value=True)
Is a boolean or string that determines if the interact button is shown in touch controls, and what text is displayed on the button. When set to 'true', the default 'Use Item' text will be used.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool | str
|
Determines if the interact button is shown in touch controls, and what text is displayed on the button. Defaults to True. |
True
|
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_interact_button
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemLiquidClipped
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(value)
Determines whether an item interacts with liquid blocks on use.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
Whether an item interacts with liquid blocks on use. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_liquid_clipped
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemMaxStackSize
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(stack_size)
Determines how many of an item can be stacked together.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stack_size
|
int
|
How many of an item that can be stacked together. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_max_stack_size
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemProjectile
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(projectile_entity, minimum_critical_power)
Compels the item to shoot, similarly to an arrow. Items with minecraft:projectile can be shot from dispensers or used as ammunition for items with the minecraft:shooter item component. Additionally, this component sets the entity that is spawned for items that also contain the minecraft:throwable component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
projectile_entity
|
Identifier
|
The entity to be fired as a projectile. |
required |
minimum_critical_power
|
int
|
Defines the time a projectile needs to charge in order to critically hit. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_projectile
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemRecord
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(sound_event, duration, comparator_signal=1)
Used by record items to play music.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sound_event
|
str
|
Set the placement block name for the planter item. |
required |
duration
|
float
|
Duration of sound event in Seconds float value. |
required |
comparator_signal
|
int
|
Signal strength for comparator blocks to use from 1 - 13. |
1
|
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_record
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemRepairable
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(on_repaired=None)
Defines the items that can be used to repair a defined item, and the amount of durability each item restores upon repair. Each entry needs to define a list of strings for 'items' that can be used for the repair and an optional 'repair_amount' for how much durability is repaired.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
on_repaired (Literal["minecraft
|
celebrate", None]): Event that is called when this item has been repaired. |
required |
Documentation reference: https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_repairable
__iter__()
Iterates over the component's fields.
add_items(repair_amount, repair_items)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repair_amount
|
int
|
How much durability is repaired. |
required |
repair_items
|
list[ItemDescriptor | str]
|
List of repair item entries. |
required |
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemShooter
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(charge_on_draw=False, max_draw_duration=0.0, scale_power_by_draw_duration=False)
Sets the shooter item component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
charge_on_draw
|
bool
|
Sets if the item is charged when drawn (Like crossbows). Defaults to False. |
False
|
max_draw_duration
|
float
|
How long can it be drawn before it will release automatically. Defaults to 0.0. |
0.0
|
scale_power_by_draw_duration
|
bool
|
Scale the power by draw duration? When true, the longer you hold, the more power it will have when released.. Defaults to False. |
False
|
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_shooter
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemShouldDespawn
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(value)
Determines if an item should despawn while floating in the world.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
Sets whether the item should eventually despawn while floating in the world. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_should_despawn
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemStackedByData
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(value)
Determines if the same item with different aux values can stack. Additionally, this component defines whether the item actors can merge while floating in the world.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
Sets whether the same item with different aux values can stack and merge while floating in the world. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_stacked_by_data
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemStorageItem
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(allow_nested_storage_items=True, max_slots=64)
Enables an item to store data of the dynamic container associated with it. A dynamic container is a container for storing items that is linked to an item instead of a block or an entity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
allow_nested_storage_items
|
bool
|
Determines whether another Storage Item is allowed inside of this item. Default is True. |
True
|
max_slots
|
int
|
The maximum allowed weight of the sum of all contained items. Maximum is 64. Default is 64. |
64
|
max_weight_limit
|
float
|
The maximum weight limit of the items in the storage item. Default is 64.0. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_storage_item
__iter__()
Iterates over the component's fields.
allowed_items(*items)
List of items that are exclusively allowed in this Storage Item. If empty all items are allowed.
banned_items(*items)
List of items that are not allowed in this Storage Item.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemStorageWeightLimit
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(max_weight_limit=64.0)
Specifies the maximum weight limit that a storage item can hold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_weight_limit
|
float
|
The maximum allowed weight of the sum of all contained items. Maximum is 64. Default is 64. Value must be <= 64. |
64.0
|
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_storage_weight_limit
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemStorageWeightModifier
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(weight_in_storage_item=4)
Specifies the weight of this item when inside another Storage Item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
weight_in_storage_item
|
int
|
The weight of this item when inside another Storage Item. Default is 4. 0 means item is not allowed in another Storage Item. |
4
|
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_storage_weight_modifier
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemSwingDuration
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(value=0.3)
Duration, in seconds, of the item's swing animation played when mining or attacking.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float
|
Duration in seconds. Affects visuals only and does not impact gameplay mechanics. |
0.3
|
Documentation reference:
https://learn.microsoft.com/en-us/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_swing_duration
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemThrowable
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(do_swing_animation=False, launch_power_scale=1.0, max_draw_duration=0.0, max_launch_power=1.0, min_draw_duration=0.0, scale_power_by_draw_duration=False)
Sets the throwable item component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
do_swing_animation
|
bool
|
Whether the item should use the swing animation when thrown. Defaults to False. |
False
|
launch_power_scale
|
float
|
The scale at which the power of the throw increases. Defaults to 1.0. |
1.0
|
max_draw_duration
|
float
|
The maximum duration to draw a throwable item. Defaults to 0.0. |
0.0
|
max_launch_power
|
float
|
The maximum power to launch the throwable item. Defaults to 1.0. |
1.0
|
min_draw_duration
|
float
|
The minimum duration to draw a throwable item. Defaults to 0.0. |
0.0
|
scale_power_by_draw_duration
|
bool
|
Whether or not the power of the throw increases with duration charged. When true, The longer you hold, the more power it will have when released. Defaults to False. |
False
|
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_throwable
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemUseAnimation
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(value)
Determines which animation plays when using an item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
Which animation to play when using an item. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_use_animation
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemUseModifiers
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(use_duration, movement_modifier=1.0, emit_vibrations=True)
Determines how long an item takes to use in combination with components such as Shooter, Throwable, or Food.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
use_duration
|
float
|
How long the item takes to use in seconds. |
required |
movement_modifier
|
float
|
Modifier value to scale the players movement speed when item is in use. Defaults to 1.0. |
1.0
|
emit_vibrations
|
bool
|
Whether vibrations are emitted when the item starts or stops being used. Defaults to True. |
True
|
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_use_modifiers?view=minecraft-bedrock-stable
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |
ItemWearable
Bases: _BaseComponent
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
| Name | Type | Description |
|---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the addon object. |
__init__(slot, protection=0)
Sets the wearable item component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slot
|
Slots
|
Determines where the item can be worn. If any non-hand slot is chosen, the max stack size is set to 1. |
required |
protection
|
int
|
How much protection the wearable has. Defaults to 0. |
0
|
dispensable
|
bool
|
Whether or not the item can be dispensed from a dispenser. Defaults to True. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_wearable
__iter__()
Iterates over the component's fields.
set_identifier_data(data)
Sets the data of the addon object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
any
|
The data to be set for the addon object. |
required |