Items - Components Module
anvil.api.items.components
Ammunition
Bases: JsonObject
An item a shooter can fire.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
item
|
str | Item
|
The ammunition item. It needs a |
required |
search_inventory
|
bool
|
Whether the inventory is searched for the ammunition. Game default false. |
required |
use_in_creative
|
bool
|
Whether the ammunition can be used in creative mode. Game default false. |
required |
use_offhand
|
bool
|
Whether the ammunition can be used from the off hand. Game default false. |
required |
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The JSON payload of this object, built from its fields after checking them.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of this object's JSON, adding the parts it uses to definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definitions
|
dict[str, JsonSchema]
|
The |
required |
__validate__()
Cross-field checks, run on export after the fields are checked.
DestroySpeed
Bases: JsonObject
How fast a digger item breaks a block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block
|
str | Block | BlockDescriptor
|
The block, by descriptor, identifier or tag query. |
required |
speed
|
int
|
Digging speed for the block. |
required |
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The JSON payload of this object, built from its fields after checking them.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of this object's JSON, adding the parts it uses to definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definitions
|
dict[str, JsonSchema]
|
The |
required |
__validate__()
Cross-field checks, run on export after the fields are checked.
DurabilityThreshold
Bases: JsonObject
A durability threshold, and the effects emitted when it is met.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
durability
|
int
|
The effects are emitted when the item durability is less than or equal to this value. |
required |
particle_type
|
str
|
Particle effect to emit when the threshold is met. |
required |
sound_event
|
str
|
Sound event emitted when the threshold is met: a built-in sound event, or any sound event from |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The JSON payload of this object, built from its fields after checking them.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of this object's JSON, adding the parts it uses to definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definitions
|
dict[str, JsonSchema]
|
The |
required |
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemAllowOffHand
Bases: JsonValueComponent
Determines whether the item can be placed in the off hand slot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
Whether the item can be placed in the off hand slot. Defaults to True. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemBlockPlacer
Bases: JsonComponent
Sets the item as a placer item component for blocks. Items with this component will place a block when used.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block
|
str | Block | BlockDescriptor
|
The block that will be placed. |
required |
replace_block_item
|
bool
|
If true, the item is registered as the item for this block, and is returned when the block is broken or picked. The item identifier must match the block identifier. Game default false. |
required |
aligned_placement
|
bool
|
Whether block placement is aligned while the interaction button is held down. Requires format version 1.26.10. |
required |
use_on
|
list[str | Block | BlockDescriptor]
|
Blocks this item can be used on, at most 256. If empty, all blocks are allowed. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemBundleInteraction
Bases: JsonComponent
Enables the bundle-specific interaction scheme and tooltip for an item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_viewable_slots
|
int
|
The maximum number of slots in the bundle viewable by the player, from 1 to 64. Game default 12. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemCanDestroyInCreative
Bases: JsonValueComponent
Determines whether the item can be used to destroy blocks while in creative mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
Whether the item breaks blocks in creative mode while swinging. Defaults to True. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemCompostable
Bases: JsonComponent
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
|
int
|
The chance of this item to create a layer upon composting, from 1 to 100. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemCooldown
Bases: JsonComponent
Adds a cooldown to an item, preventing it from being used again for a specified duration. Items sharing the same category enter cooldown together.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
category
|
str
|
Groups items together. When an item is used, all items of its category enter cooldown. |
required |
duration
|
int
|
How long, in seconds, the items of the category spend cooling down. |
required |
type
|
ItemCooldownType
|
The action that triggers the cooldown, "use" or "attack". Game default "use". |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemCustomComponent
Bases: JsonCustomComponent
Base of custom components: components registered by a script, with parameters.
Subclass it with an identifier and the parameters as fields. The identifier is in the project
namespace: a name without one gets it, any other namespace is refused.
class Explosive(ItemCustomComponent):
identifier = "explosive"
power: float = json_field()
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemDamage
Bases: JsonValueComponent
Determines how much extra damage the item deals when attacking.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
int
|
Extra damage added to the base attack damage, from 0 to 32767. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemDamageAbsorption
Bases: JsonComponent
Allows an item worn in an armor slot to absorb damage that would otherwise be dealt to its wearer. The absorbed damage reduces the item's durability.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
absorbable_causes
|
list[DamageCause]
|
The damage causes the item can absorb, at least 1. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemDigger
Bases: JsonComponent
Configures an item as a digging tool, allowing it to break specific blocks faster than normal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
destroy_speeds
|
list[DestroySpeed]
|
The blocks this item digs, and how fast. Set them directly or add them with |
required |
use_efficiency
|
bool
|
Whether the Efficiency enchantment increases the dig speed. Game default false. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
add_destroy_speed(*, block, speed)
Adds a block and its digging speed. See DestroySpeed for the parameters.
Returns:
| Name | Type | Description |
|---|---|---|
ItemDigger |
Self for method chaining. |
ItemDisplayName
Bases: JsonComponent
Sets the item display name. The item writes it as the localization key item.<identifier>.name and adds the name to the language file under that key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
The name shown for the item. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Adds the name to the language file under item.<identifier>.name, then writes that key.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemDurability
Bases: JsonComponent
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
|
The amount of damage this item can take before breaking. Minimum 0. |
required |
damage_chance
|
tuple[float, float]
|
The |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemDurabilitySensor
Bases: JsonComponent
Enables an item to emit effects when it receives damage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
durability_thresholds
|
list[DurabilityThreshold]
|
The thresholds and their effects, at least 1. Set them directly or add them with |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
add_durability_threshold(*, durability, particle_type=None, sound_event=None)
Adds a durability threshold. See DurabilityThreshold for the parameters.
Returns:
| Name | Type | Description |
|---|---|---|
ItemDurabilitySensor |
Self for method chaining. |
ItemDyeable
Bases: JsonComponent
Enables players to dye this item, like leather armor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
default_color
|
HexRGB | HexRGBA | RGB | RGBA | RGB255 | RGBA255
|
The color of the item when undyed. Written as a hex color. Game default white. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemEnchantable
Bases: JsonComponent
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 |
|---|---|---|---|
slot
|
EnchantsSlots
|
Which types of enchantments can be applied. For example, |
required |
value
|
int
|
The enchantability of the item. Minimum 0. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemEntityPlacer
Bases: JsonComponent
Allows an item to place entities into the world, and to set the spawn type of a monster spawner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity
|
str | Entity
|
The entity to be placed in the world. |
required |
dispense_on
|
list[str | Block | BlockDescriptor]
|
Blocks this item can be dispensed on. If empty, all blocks are allowed. |
required |
use_on
|
list[str | Block | BlockDescriptor]
|
Blocks this item can be used on. If empty, all blocks are allowed. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemFireResistant
Bases: JsonComponent
Determines whether the item is immune to burning when dropped in fire or lava.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
Whether the item is immune to burning. Defaults to True. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemFood
Bases: JsonComponent
Sets the item as a food component, allowing it to be edible to the player.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
can_always_eat
|
bool
|
Whether the item can be eaten even when not hungry. Game default false. |
required |
nutrition
|
int
|
The value added to the entity's nutrition when the item is used. Game default 0. |
required |
saturation_modifier
|
float
|
Used in |
required |
using_converts_to
|
str | Item
|
The item this one converts to when used. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemFuel
Bases: JsonComponent
Allows this item to be used as fuel in a furnace to 'cook' other items.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration
|
int
|
How long, in seconds, this fuel cooks items for. Minimum 0.05. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemGlint
Bases: JsonValueComponent
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. Defaults to True. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemHandEquipped
Bases: JsonValueComponent
Determines whether the item is rendered like a tool while in the player's hand.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
Whether the item is rendered like a tool. Defaults to True. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemHoverTextColor
Bases: JsonValueComponent
Determines the color of the item name when hovering over it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
HexRGB | HexRGBA | RGB | RGBA | RGB255 | RGBA255
|
The color of the item hover text. Written as a hex color. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemIcon
Bases: JsonComponent
Determines the icon that represents the item in the UI and elsewhere. The texture is added to the resource pack and to item_texture.json.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
textures
|
TextureComponents
|
The icon texture and its PBR maps. Written as |
required |
blockbench
|
str
|
The Blockbench project to take the textures from. Not written to the JSON. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemInteractButton
Bases: JsonValueComponent
Determines whether the interact button is shown in touch controls, and the text on it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool | str
|
True shows the default "Use Item" text. A string is added to the language file and shown instead. Defaults to True. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemKineticWeapon
Bases: JsonComponent
Allows an item to deal kinetic damage and its effects every tick while in use, along the user's view vector. Damage depends on the user's and the target's velocity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reach
|
tuple[float, float]
|
The |
required |
creative_reach
|
tuple[float, float]
|
The reach in Creative mode. Defaults to |
required |
damage_modifier
|
float
|
Value added to the scaled dot product, after |
required |
damage_multiplier
|
float
|
Value the sum of the projected velocities is multiplied by. Game default 1. |
required |
delay
|
int
|
Time, in ticks, after which kinetic damage and its effects start being applied. Game default 0. |
required |
hitbox_margin
|
float
|
Added tolerance to the view vector raycast. Game default 0. |
required |
damage_conditions
|
KineticEffectConditions
|
Conditions for damage to be applied. If not set, damage is not applied. |
required |
knockback_conditions
|
KineticEffectConditions
|
Conditions for knockback to be applied. If not set, knockback is not applied. |
required |
dismount_conditions
|
KineticEffectConditions
|
Conditions for riders to be dismounted. If not set, riders cannot be dismounted. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
set_damage_conditions(*, max_duration=None, min_relative_speed=None, min_speed=None)
Sets the conditions for damage to be applied. See KineticEffectConditions for the parameters.
Returns:
| Name | Type | Description |
|---|---|---|
ItemKineticWeapon |
Self for method chaining. |
set_dismount_conditions(*, max_duration=None, min_relative_speed=None, min_speed=None)
Sets the conditions for riders to be dismounted. See KineticEffectConditions for the parameters.
Returns:
| Name | Type | Description |
|---|---|---|
ItemKineticWeapon |
Self for method chaining. |
set_knockback_conditions(*, max_duration=None, min_relative_speed=None, min_speed=None)
Sets the conditions for knockback to be applied. See KineticEffectConditions for the parameters.
Returns:
| Name | Type | Description |
|---|---|---|
ItemKineticWeapon |
Self for method chaining. |
ItemLiquidClipped
Bases: JsonValueComponent
Determines whether the item interacts with liquid blocks on use.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
Whether the item interacts with liquid blocks on use. Defaults to True. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemMaxStackSize
Bases: JsonValueComponent
Determines how many of an item can be stacked together.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
int
|
How many of the item can be stacked together, from 1 to 64. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemPiercingWeapon
Bases: JsonComponent
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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reach
|
tuple[float, float]
|
The |
required |
creative_reach
|
tuple[float, float]
|
The reach in Creative mode. Defaults to |
required |
hitbox_margin
|
float
|
Added tolerance to the view vector raycast. Game default 0. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemProjectile
Bases: JsonComponent
Defines an item as a projectile that can be shot from dispensers or used as ammunition by minecraft:shooter. With minecraft:throwable, sets the entity spawned when the item is thrown.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
projectile_entity
|
str | Entity
|
The entity fired as a projectile. A spawn event can be added as |
required |
minimum_critical_power
|
float
|
How long the projectile must be charged to critically hit. Game default 0. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemRarity
Bases: JsonValueComponent
Specifies the base rarity of the item, and so the color of its name when hovered. Overridden by minecraft:hover_text_color.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Rarity
|
The base rarity. It rises when the item is enchanted. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemRecord
Bases: JsonComponent
Used by record items to play music.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sound_event
|
str
|
The sound event played. |
required |
duration
|
int
|
Duration of the sound event, in seconds. Game default 0. |
required |
comparator_signal
|
int
|
Signal strength for comparator blocks, from 1 to 13. Game default 1. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemRepairable
Bases: JsonComponent
Defines the items that can repair this item, and how much durability each restores.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repair_items
|
list[RepairItem]
|
The repair entries. Set them directly or add them with |
required |
on_repaired
|
str
|
Event triggered when this item has been repaired, for example "minecraft:celebrate". |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
add_repair_item(*, items, repair_amount=None)
Adds a repair entry. See RepairItem for the parameters.
Returns:
| Name | Type | Description |
|---|---|---|
ItemRepairable |
Self for method chaining. |
ItemSeed
Bases: JsonComponent
Sets the item as a seed that can be planted to grow crops.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
crop_result
|
str | Block | BlockDescriptor
|
The block placed when the seed is planted. |
required |
plant_at
|
list[str | Block | BlockDescriptor]
|
Blocks this seed can be planted on or attached to. If not set, standard farmland rules apply. |
required |
plant_at_any_solid_surface
|
bool
|
Deprecated. Has no effect from format version 1.19.0. |
required |
plant_at_face
|
ItemPlantAtFace
|
Deprecated. Has no effect from format version 1.19.0. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemShooter
Bases: JsonComponent
Compels an item to shoot projectiles, like a bow or crossbow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ammunition
|
list[Ammunition]
|
The items that can be fired. Set them directly or add them with |
required |
charge_on_draw
|
bool
|
Whether the shooter charges when the player starts drawing, like a crossbow. Game default false. |
required |
max_draw_duration
|
int
|
How long, in seconds, the shooter can be drawn before it fires or reaches full power. Game default 0. |
required |
scale_power_by_draw_duration
|
bool
|
Whether launch power grows with draw time. Game default false. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
add_ammunition(*, item, search_inventory=None, use_in_creative=None, use_offhand=None)
Adds an ammunition entry. See Ammunition for the parameters.
Returns:
| Name | Type | Description |
|---|---|---|
ItemShooter |
Self for method chaining. |
ItemShouldDespawn
Bases: JsonValueComponent
Determines whether the item should eventually despawn while floating in the world.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
Whether the item despawns. Defaults to True. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemStackedByData
Bases: JsonValueComponent
Determines whether the same item with different aux values can stack, and whether the item entities can merge while floating in the world.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
Whether items with different aux values stack and merge. Defaults to True. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemStorageItem
Bases: JsonComponent
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
|
Whether another storage item is allowed inside this item. Game default true. |
required |
allowed_items
|
list[str | Item]
|
Items that are exclusively allowed in this storage item. If empty, all items are allowed. |
required |
banned_items
|
list[str | Item]
|
Items that are not allowed in this storage item. |
required |
max_slots
|
int
|
The maximum number of slots, from 1 to 64. Game default 64. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemStorageWeightLimit
Bases: JsonComponent
Specifies the maximum weight limit that a storage item can hold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_weight_limit
|
int
|
The maximum allowed weight of the sum of all contained items, at most 64. Game default 64. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemStorageWeightModifier
Bases: JsonComponent
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 inside another storage item. 0 means the item is not allowed in one. Game default 4. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemSwingDuration
Bases: JsonComponent
Duration, in seconds, of the item's swing animation when mining or attacking. Affects visuals only.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
int
|
The swing duration in seconds. Game default 0.3. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemSwingSounds
Bases: JsonComponent
Overrides the swing sounds emitted by the user. Each field takes a sound event from sound_definitions.json, including vanilla ones.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attack_critical_hit
|
str
|
Sound played when an attack hits and deals critical damage. |
required |
attack_hit
|
str
|
Sound played when an attack hits. |
required |
attack_miss
|
str
|
Sound played when an attack misses or deals no damage due to invulnerability. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemTags
Bases: JsonComponent
Determines which tags are included on the item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tags
|
list[MinecraftItemTags | str]
|
The item tags. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemThrowable
Bases: JsonComponent
Makes an item throwable by the player, like a snowball or ender pearl. Use with minecraft:projectile to set the entity spawned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
do_swing_animation
|
bool
|
Whether the item uses the swing animation when thrown. Game default false. |
required |
launch_power_scale
|
float
|
The scale at which the power of the throw increases. Game default 1.0. |
required |
max_draw_duration
|
int
|
The maximum duration to draw the item. Game default 0. |
required |
max_launch_power
|
float
|
The maximum launch power. Game default 1.0. |
required |
min_draw_duration
|
int
|
The minimum duration to draw the item. Game default 0. |
required |
scale_power_by_draw_duration
|
bool
|
Whether the power of the throw grows with draw time. Game default false. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemUseAnimation
Bases: JsonValueComponent
Specifies which animation is played when the player uses the item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
ItemUseAnimations
|
The animation played when the item is used. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemUseModifiers
Bases: JsonComponent
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
|
Time, in seconds, that the item takes to use. Minimum 0. |
required |
movement_modifier
|
float
|
Multiplier applied to the player's movement speed while the item is in use. At most 1. |
required |
emit_vibrations
|
bool
|
Whether vibrations are emitted when the item starts or stops being used. Game default true. |
required |
start_sound
|
str
|
Sound event played when the item starts being used: a built-in sound event, or any sound event from |
required |
start_using
|
ItemStartUsing
|
When the player begins using the item. Game default "always". Requires format version 1.26.30. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemWearable
Bases: JsonComponent
Allows an item to be worn by a player in an equipment slot. A non-hand slot sets the max stack size to 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slot
|
ItemWearableSlots
|
Where the item can be worn. |
required |
protection
|
int
|
How much protection the item provides. Game default 0. |
required |
hides_player_location
|
bool
|
Whether the wearer is hidden on locator maps and the locator bar. Game default false. |
required |
dispensable
|
bool
|
Whether the item can be equipped by a dispenser. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
KineticEffectConditions
Bases: JsonObject
Conditions that need to be satisfied for an effect of a kinetic weapon to be applied.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_duration
|
int
|
Time, in ticks, during which the effect can be applied after |
required |
min_relative_speed
|
float
|
Minimum relative speed of the user with respect to the target, projected onto the view vector. Game default 0. |
required |
min_speed
|
float
|
Minimum speed of the user, projected onto the view vector. Game default 0. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The JSON payload of this object, built from its fields after checking them.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of this object's JSON, adding the parts it uses to definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definitions
|
dict[str, JsonSchema]
|
The |
required |
__validate__()
Cross-field checks, run on export after the fields are checked.
RepairItem
Bases: JsonObject
Items that repair an item, and how much durability they restore.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
list[str | Item]
|
Items that may be used to repair the item. |
required |
repair_amount
|
Molang | float
|
How much the item is repaired. |
required |
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The JSON payload of this object, built from its fields after checking them.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of this object's JSON, adding the parts it uses to definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definitions
|
dict[str, JsonSchema]
|
The |
required |
__validate__()
Cross-field checks, run on export after the fields are checked.