Items - Components Module
anvil.api.items.components
ItemAllowOffHand
Bases: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__init__(block, replace_block_item=False, aligned_placement=False, use_on=None)
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 |
replace_block_item
|
bool
|
If true, the item will be registered as the item for this block. This item will be returned by default when the block is broken/picked. Note: the identifier for this item must match the block's identifier for this field to be valid. |
False
|
aligned_placement
|
bool
|
When true, block placement through this item will be aligned while holding the interaction button down. |
False
|
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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__init__(category, duration, type='use')
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 |
type
|
Literal['attack', 'use']
|
The type of action the cooldown applies to. Options are mutually exclusive, so cooldown for one type of action does not affect the others. Values: "use" (when using an item), "attack" (when attack with an item). Defaults to "use". |
'use'
|
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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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 |
ItemDurabilitySensor
Bases: Component
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__()
Enables an item to emit effects when it receives damage.
This component requires minecraft:durability and at least one
durability threshold entry.
Documentation reference:
https://learn.microsoft.com/en-us/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_durability_sensor
__iter__()
Iterates over the component's fields.
add_threshold(durability, particle_type=None, sound_event=None)
Adds a durability threshold entry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
durability
|
int
|
Emit effects when item durability is less than or equal to this value. |
required |
particle_type
|
str | None
|
Particle effect to emit when the threshold is met. |
None
|
sound_event
|
str | None
|
Sound effect to emit when the threshold is met. |
None
|
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 |
ItemDyeable
Bases: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__init__(default_color)
Enables custom items to be dyed in cauldrons
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
default_color
|
Color
|
The default color of the item. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_dyeable
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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=1)
DEPRECATED
Sets the effects of the food item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
effect
|
MinecraftEffects
|
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. |
1
|
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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__init__(blockbench, component=None)
Sets the icon item component. Determines the icon to represent the item in the UI and elsewhere.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blockbench
|
str | TextureComponents
|
Either the Blockbench project file name (str) or TextureComponents directly. |
required |
component
|
TextureComponents | None
|
The texture components if blockbench is a string, otherwise None. |
None
|
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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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 |
ItemKineticWeapon
Bases: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__init__(reach=None, creative_reach=None, damage_modifier=0, damage_multiplier=1, delay=0, hitbox_margin=0)
Specifies that the item is a kinetic weapon that uses kinetic energy when used.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
energy_per_use
|
int
|
The amount of kinetic energy consumed per use of the weapon. Default is 100. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_kinetic_weapon
__iter__()
Iterates over the component's fields.
damage_conditions(max_duration=-1, min_relative_speed=0.0, min_speed=0.0)
Conditions for applying damage when using the kinetic weapon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_duration
|
Tick
|
Time, in ticks, during which the effect can be applied after "delay" elapses. If negative, the effect is applied indefinitely. Default is -1. |
-1
|
min_relative_speed
|
float
|
Minimum relative speed of the user with respect to the target (projected onto the view vector via a dot product) required for the effect to be applied. Default is 0.0. |
0.0
|
min_speed
|
float
|
Minimum user's speed (projected onto the view vector via a dot product) required for the effect to be applied. Default is 0.0. |
0.0
|
dismount_conditions(max_duration=-1, min_relative_speed=0.0, min_speed=0.0)
Conditions for applying damage when using the kinetic weapon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_duration
|
Tick
|
Time, in ticks, during which the effect can be applied after "delay" elapses. If negative, the effect is applied indefinitely. Default is -1. |
-1
|
min_relative_speed
|
float
|
Minimum relative speed of the user with respect to the target (projected onto the view vector via a dot product) required for the effect to be applied. Default is 0.0. |
0.0
|
min_speed
|
float
|
Minimum user's speed (projected onto the view vector via a dot product) required for the effect to be applied. Default is 0.0. |
0.0
|
knockback_conditions(max_duration=-1, min_relative_speed=0.0, min_speed=0.0)
Conditions for applying damage when using the kinetic weapon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_duration
|
Tick
|
Time, in ticks, during which the effect can be applied after "delay" elapses. If negative, the effect is applied indefinitely. Default is -1. |
-1
|
min_relative_speed
|
float
|
Minimum relative speed of the user with respect to the target (projected onto the view vector via a dot product) required for the effect to be applied. Default is 0.0. |
0.0
|
min_speed
|
float
|
Minimum user's speed (projected onto the view vector via a dot product) required for the effect to be applied. Default is 0.0. |
0.0
|
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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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 |
ItemPiercingWeapon
Bases: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__init__(reach=None, creative_reach=None, hitbox_margin=0)
Allows an item to deal damage to all entities detected in a straight line along the user's view vector. Items with this component cannot destroy blocks, as the attack action always takes priority, regardless of what the user is looking at.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reach
|
Tuple[float, float]
|
The minimum and maximum reach of the weapon in survival mode. If not provided, defaults to the values defined in the Kinetic Weapon component if present, or standard melee reach values otherwise. |
None
|
creative_reach
|
Tuple[float, float]
|
The minimum and maximum reach of the weapon in creative mode. If not provided, defaults to the values defined in the Kinetic Weapon component if present, or standard melee reach values otherwise. |
None
|
hitbox_margin
|
float
|
Additional margin added to the hitbox size when detecting entities along the view vector. Default is 0. |
0
|
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_piercing_weapon
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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 |
ItemRarity
Bases: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__init__(value)
Specifies the base rarity of the item, affecting the color of its name unless overridden by 'minecraft:hover_text_color'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Rarity
|
The base rarity of the item. |
required |
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_rarity
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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[MinecraftItemDescriptor | 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 |
ItemSeed
Bases: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__init__(crop_result, plant_at=None, plant_at_any_solid_surface=False, plant_at_face=None)
Sets the item as a seed that can be planted to grow crops.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
crop_result
|
MinecraftBlockDescriptor | Identifier
|
The block identifier placed when the seed is planted. |
required |
plant_at
|
list[MinecraftBlockDescriptor | Identifier | str] | None
|
Block identifiers this seed can be planted on or attached to. |
None
|
plant_at_any_solid_surface
|
bool
|
Deprecated legacy setting that allows planting on any solid surface. |
False
|
plant_at_face
|
Literal['UP', 'DOWN'] | None
|
Deprecated legacy setting for the face the seed can be planted on. |
None
|
Documentation reference:
https://learn.microsoft.com/en-us/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_seed
__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 |
ItemShooter
Bases: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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 |
ItemSwingSounds
Bases: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__init__(attack_critical_hit, attack_hit, attack_miss)
Sound played when the item is swung.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attack_critical_hit
|
str
|
Sound event played when the item is swung and a critical hit is achieved. |
required |
attack_hit
|
str
|
Sound event played when the item is swung and hits a target. |
required |
attack_miss
|
str
|
Sound event played when the item is swung and misses a target. |
required |
Documentation reference:
https://learn.microsoft.com/en-us/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_swing_sounds
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__init__(use_duration, movement_modifier=1.0, emit_vibrations=True, start_sound=None)
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
|
start_sound
|
str
|
Sound event played when the item starts being used. |
None
|
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: Component
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. |
__export__()
Exports the component as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The exported component. |
__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 |