Minecraft:Item components
More actions
|
For the {{{Description}}} of the same name, see [[{{{Destination}}}]]. |
Script error: No such module "Exclusive". Item components are Minecraft:JSON formatted for items in Minecraft:add-ons used to change how your item looks and functions in the world, and also have NBT components that also work on vanilla items.
Applying components
They are applied within the
- REDIRECT Template:Code
Template:Redr field within the
- REDIRECT Template:Code
Template:Redr field, components can also be applied to vanilla items, but unlike custom items they are limited to a few components.
Component types
minecraft:allow_off_hand
Allows the item to be placed in the offhand but does not allow use of the item.
It has no field, it must be a boolean value being either
- REDIRECT Template:Code
- REDIRECT Template:Code
Example: <syntaxhighlight lang="json" copy> "minecraft:allow_off_hand": true </syntaxhighlight>
minecraft:block_placer
Allows the item to place blocks when used, if used in survival the item is consumed.
The available fields are:
- REDIRECT Template:Code
- Defines the block that will be positioned.
- REDIRECT Template:Code
- Defines whether the item will replace the block, it can be
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr if it is
- REDIRECT Template:Code
Template:Redr the block and the item must have the same
- REDIRECT Template:Code
Template:Redr and the
- REDIRECT Template:Code
Template:Redr field can be omitted merging the two into one thing.
- REDIRECT Template:Code
- Defines whether the block placement through this item will be aligned while holding the interaction button down, it can be
- REDIRECT Template:Code
- REDIRECT Template:Code
- REDIRECT Template:Code
- List of block descriptors that contain blocks this item can be used on. If left blank, all blocks will be allowed. This also applies to Creative mode.
Example: <syntaxhighlight lang="json" copy> "minecraft:block_placer": {
"block": "wiki:custom_block",
"replace_block_item": true,
"aligned_placement": true,
"use_on": [
"minecraft:dirt",
"wiki:custom_dirt"
]
} </syntaxhighlight>
minecraft:bundle_interaction
Enables the Minecraft:bundle interface and functionality on the item. The item must have the [[#minecraft:storage_item|
- REDIRECT Template:Code
Template:Redr]] component for this component to work.
The available fields are:
- REDIRECT Template:Code
- Sets the maximum number of visible item stacks between 1 and 64 from the pack tooltip going from right to left.
Example: <syntaxhighlight lang="json" copy> "minecraft:bundle_interaction": {
"num_viewable_slots": 12
} </syntaxhighlight>
minecraft:compostable
Allows an item to be used in a Minecraft:composter.
The available fields are:
- REDIRECT Template:Code
- Sets the chance to increase the level of the compost can be a value between 0 and 100.
Example: <syntaxhighlight lang="json" copy> "minecraft:compostable": {
"composting_chance": 50 // 50% chance to increase compost bin level
} </syntaxhighlight>
minecraft:cooldown
Cooldown component. After use, all items in a specified "cooldown category" become unusable for a period of time specified in the component. The item must have the [[#minecraft:use_modifiers|
- REDIRECT Template:Code
Template:Redr]] component for this component to work.
The available fields are:
- REDIRECT Template:Code
- The item's cooldown category.
- REDIRECT Template:Code
- The cooldown duration (in seconds) that items with a matching category will take to charge before becoming usable again, if this value is a negative number the item will become unusable.
- REDIRECT Template:Code
- Defines the action to which the cooldown applies, in a mutually exclusive manner. The cooldown of one type of action does not affect the other. This can be:
- Defines the action to which the cooldown applies, in a mutually exclusive manner. The cooldown of one type of action does not affect the other. This can be:
- REDIRECT Template:Code
Template:Redr — activates the cooldown only when using the item, allowing other actions.
- REDIRECT Template:Code
Template:Redr — activates cooldown when attacking, preventing further attacks until time runs out. Example: <syntaxhighlight lang="json" copy> "minecraft:cooldown": {
"category": "spear", "duration": 1.0, "type": "attack"
} </syntaxhighlight>
minecraft:damage
Defines how much extra damage the item deals in an attack, the value must be positive.
The available fields are:
- Any positive number, the actual damage is always the set value + 1, values between 0 and 32.767 are read.
Example: <syntaxhighlight lang="json" copy> "minecraft:damage": 10 </syntaxhighlight>
minecraft:damage_absorption
Causes the item to absorb damage that would otherwise be dealt to the entity wearing it. For this to happen, the item must have the [[#minecraft:durability|
- REDIRECT Template:Code
Template:Redr]] component and be equipped in an armor slot.
The available fields are:
- REDIRECT Template:Code
- List of damage deals (such as
- REDIRECT Template:Code
Template:Redr and
- REDIRECT Template:Code
Template:Redr) that can be absorbed by the item. Example: <syntaxhighlight lang="json" copy> "minecraft:damage_absorption": {
"absorbable_causes": ["all"]
} </syntaxhighlight>
minecraft:digger
Determine how quickly an item can break specific blocks.
The available fields are:
- REDIRECT Template:Code
- List of blocks to break, with correlated extraction speeds.
- List of blocks to break, with correlated extraction speeds.
- REDIRECT Template:Code
Template:Redr — which block the item will break, and you can put the
- REDIRECT Template:Code
Template:Redr entry for a Minecraft:molang query.
- REDIRECT Template:Code
Template:Redr — how fast the block will be broken, accepting negative values if it is negative the item will never break the block.
- REDIRECT Template:Code
- Defines whether the item should be affected if the efficiency enchantment is applied to it. Can be
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr. Example: <syntaxhighlight lang="json" copy> "minecraft:digger": {
"use_efficiency": true,
"destroy_speeds": [
{
"block": {
"tags": "q.any_tag('stone', 'metal')" // Note that not all blocks have tags; you may need to list many blocks.
},
"speed": 6
},
{
"block": "minecraft:grass_block",
"speed": 7
}
]
} </syntaxhighlight>
minecraft:display_name
Sets the text displayed when an item's name is displayed.
The available fields are:
- REDIRECT Template:Code
- It can be any word for fixed text, or a translation key that must be specified in the language file.
Example: <syntaxhighlight lang="json" copy> "minecraft:display_name": {
"value": "secret weapon"
} </syntaxhighlight> Example with translation key: <syntaxhighlight lang="json" copy> "minecraft:display_name": {
"value": "item.snowball.name"
} </syntaxhighlight>
minecraft:durability
It sets the item's durability and also allows the item to be repaired with the combination of the same item on the crafting table and on the Minecraft:grindstone and on the Minecraft:anvil. When breaking a block, durability is not spent, requiring the use of the Script API, however, it loses durability when attack any Minecraft:mob, losing 2 durability points. If you use the [[#minercraft:wearable|
- REDIRECT Template:Code
Template:Redr]] component, it loses 1 durability when attack mobs.
The available fields are:
- REDIRECT Template:Code
- An object that has
- REDIRECT Template:Code
Template:Redr and
- REDIRECT Template:Code
Template:Redr fields that define the probability of the item losing durability working in conjunction with the Unbreaking enchantment must be a value from 0 to 100.
- REDIRECT Template:Code
- Sets the total durability of the item with a minimum value of 0 and a maximum of 32767. Values greater than this are considered negative and do not work.
Example: <syntaxhighlight lang="json" copy> "minecraft:durability": {
"damage_chance": {
"min": 0,
"max": 100
},
"max_durability": 100
} </syntaxhighlight>
minecraft:durability_sensor
Allows an item to emit sound effects and particles when reaching a specific level of durability.
The available fields are:
- REDIRECT Template:Code
Template:Redr: Base object to place the sub fields.
- REDIRECT Template:Code
Template:Redr: A value at which the effect will be emitted when it is less than or equal to the set value.
- REDIRECT Template:Code
Template:Redr: The particle effect to be emitted.
- REDIRECT Template:Code
Template:Redr: The sound effect to be emitted. Example: <syntaxhighlight lang="json" copy> "minecraft:durability_sensor": {
"durability_thresholds": [
{
"durability": 100,
"particle_type": "minecraft:explosion_manual",
"sound_event": "blast"
},
{
"durability": 5,
"sound_event": "raid.horn"
}
]
} </syntaxhighlight>
minecraft:dyeable
Allows an item to be dyed in a Minecraft:cauldron with water like leather armor, when dyed it uses the
- REDIRECT Template:Code
Template:Redr field of the [[#minecraft:icon|
- REDIRECT Template:Code
Template:Redr]] component.
The available fields are:
- REDIRECT Template:Code
- Optional color to use by default before player dyes item, needs to be a color in hexadecimal format.
Example: <syntaxhighlight lang="json" copy> "minecraft:dyeable": {
"default_color": "#ffffff"
} </syntaxhighlight>
minecraft:enchantable
Determines whether the item can be enchanted and which enchantments can be applied to the item.
The available fields are:
- REDIRECT Template:Code
- Which enchantments can be applied, the only non-existent category is for Minecraft:mace enchantments, for this you must use the
- REDIRECT Template:Code
Template:Redr category (ex: Using
- REDIRECT Template:Code
Template:Redr would allow this item to be enchanted as if it were a Minecraft:bow). Template:Collapse
- REDIRECT Template:Code
- The minimum enchantment value is 0 and the maximum is 256, it determines the enchantability of the item, influencing the quality and quantity of potential enchantments. Higher values increase the chance of granting more powerful enchantments. See Enchantability for vanilla values.
Example: <syntaxhighlight lang="json" copy> "minecraft:enchantable": {
"slot": "sword", "value": 10
} </syntaxhighlight>
minecraft:entity_placer
Allows the item to place specific entitys into the world.
The available fields are:
- REDIRECT Template:Code
- List of block descriptors that contain blocks on which the Minecraft:dispenser can use this item. If left blank, all blocks will be allowed.
- REDIRECT Template:Code
- The entity the item will place on.
- REDIRECT Template:Code
- List of block descriptors that contain blocks this item can be used on. If left blank, all blocks are allowed.
Example: <syntaxhighlight lang="json" copy> "minecraft:entity_placer": {
"entity": "minecraft:spider", "dispense_on": [ "minecraft:dirt" ], "use_on": [ "minecraft:dirt" ]
} </syntaxhighlight>
minecraft:fire_resistant
Determines whether items should be able to resist Minecraft:fire and Minecraft:lava instead of being destroyed like any netherite item.
The available fields are:
- REDIRECT Template:Code
- It can be
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr to define whether or not the item resists fire and lava. Example: <syntaxhighlight lang="json" copy> "minecraft:fire_resistant": {
"value": true
} </syntaxhighlight>
minecraft:food
Allows the item to be edible as a Minecraft:food. It requires the [[#minecraft:use_modifiers|
- REDIRECT Template:Code
Template:Redr]] component to work properly. To display an eating/drinking animation, also apply the [[#minecraft:use_animation|
- REDIRECT Template:Code
Template:Redr]] component to the item.
The available fields are:
- REDIRECT Template:Code
- If
- REDIRECT Template:Code
Template:Redr you can always eat this item (even when you are not hungry).
- REDIRECT Template:Code
- The value that is added to the player's nutrition when the item is used, which can be a negative value, with a maximum of
- REDIRECT Template:Code
Template:Redr as it is the maximum 32-bit value.
- REDIRECT Template:Code
- A 32-bit integer value that defines the saturation modification value that uses the calculation ({{#vardefine: out
| nutrition * saturation_modifier * 2
}}{{#vardefine: out
| {{#var: out}}
}}{{#vardefine: out
| {{#var: out}}
}}{{#vardefine: out
| {{#var: out}}
}}{{#vardefine: out
| {{#var: out}}
}}{{#vardefine: out
| {{#var: out}}
}}{{#vardefine: out
| {{#var: out}}
}}{{#var: out}}) applying the saturation value.
- REDIRECT Template:Code
- When used, converts to the item specified by the string in this field, as with stew.
Example: <syntaxhighlight lang="json" copy> "minecraft:food": {
"can_always_eat": false, "nutrition": 3, "saturation_modifier": 0.6, "using_converts_to": "bowl"
} </syntaxhighlight>
minecraft:fuel
Allows the item to be used as fuel in a smelting block such as a furnace used to smelt other items.
The available fields are:
- REDIRECT Template:Code
- How long, in seconds, this fuel will smelt items in a furnace, minimum value being
- REDIRECT Template:Code
Template:Redr and maximum value being
- REDIRECT Template:Code
Template:Redr being the 32-bit limit value. Example: <syntaxhighlight lang="json" copy> "minecraft:fuel": {
"duration": 3.0
} </syntaxhighlight>
minecraft:glint
Determines whether the item has the enchantment glint like an enchanted golden apple.
It has no field, it must be a boolean value being either
- REDIRECT Template:Code
- REDIRECT Template:Code
Example: <syntaxhighlight lang="json" copy> "minecraft:glint": false </syntaxhighlight>
minecraft:hand_equipped
Determines whether an item is rendered as a Minecraft:tool while in hand.
It has no field, it must be a boolean value being either
- REDIRECT Template:Code
- REDIRECT Template:Code
Example: <syntaxhighlight lang="json" copy> "minecraft:hand_equipped": true </syntaxhighlight>
minecraft:hover_text_color
Determines the color of the item name overriding the rarity.
It has no field, it needs to be a string value with the color name, you can see all possible values here.
Example: <syntaxhighlight lang="json" copy> "minecraft:hover_text_color": "minecoin_gold" </syntaxhighlight>
minecraft:icon
Determines the icon to represent the item in the UI and elsewhere, if
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr of the [[#minecraft:block_placer|
- REDIRECT Template:Code
Template:Redr]] component this component can be omitted and it will use the block as the visual, this can be a string or an object.
The available fields if object are:
- REDIRECT Template:Code
Template:Redr: This object contains the different textures that can be used for the item's icon. Armor textures and finish palettes can also be specified here, all specified in the
- REDIRECT Template:Code
Template:Redr file.
- REDIRECT Template:Code
- The default icon for the item.
- REDIRECT Template:Code
- The icon displayed after a dyeable item is dyed in a Minecraft:cauldron.
- REDIRECT Template:Code
- The icon overlay for when your item has a trim, by default it uses the icon corresponding to the slot defined in the [[#minecraft:wearable|
- REDIRECT Template:Code
Template:Redr]] component.
- REDIRECT Template:Code
- The color palette that the armor ornament will use for a certain material type must be a direct path to the texture.
- REDIRECT Template:Code
- The texture displayed behind the item preview with the [[#minecraft:bundle_interaction|
- REDIRECT Template:Code
Template:Redr]] component used in the Minecraft:bundle.
- REDIRECT Template:Code
- The texture displayed in front of the item preview with the [[#minecraft:bundle_interaction|
- REDIRECT Template:Code
Template:Redr]] component used in the Minecraft:bundle.
Example with string: <syntaxhighlight lang="json" copy> "minecraft:icon": "wiki:custom_item" </syntaxhighlight> Example with object: <syntaxhighlight lang="json" copy> "minecraft:icon": {
"textures": {
"default": "wiki:custom_item",
"icon_trim": "wiki:custom_item_trim",
"emerald_palette": "textures/trims/color_palettes/redstone_palette",
"bundle_open_back": "bundle_blue_open_back",
"bundle_open_front": "bundle_blue_open_front"
}
} </syntaxhighlight>
minecraft:interact_button
This component determines whether the interaction button is displayed on touch controls and what text is displayed on the button. When set to
- REDIRECT Template:Code
Template:Redr, the default text "Use Item" will be used.
It has no field, it must be a boolean value being either
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr or a string with a text or translation key.
Example with string: <syntaxhighlight lang="json" copy> "minecraft:interact_button": "Use this custom item" </syntaxhighlight> Example as boolean: <syntaxhighlight lang="json" copy> "minecraft:interact_button": true </syntaxhighlight>
minecraft:kinetic_weapon
This item component is used to replicate the charged attack used on Minecraft:spears. Allows an item to inflict damage and other effects with each tick while in use, to all unobstructed targets found in a straight line from the user's field of vision. Damage is calculated based on the speed of the user and the target projected onto the line of sight; the faster the user and the target move towards each other, the greater the final damage. After applying "
- REDIRECT Template:Code
Template:Redr" and "
- REDIRECT Template:Code
Template:Redr", the resulting damage is reduced to the nearest integer. Requires the [[#minecraft:use_modifiers|
- REDIRECT Template:Code
Template:Redr]] item component on the item.
The available fields are:
- REDIRECT Template:Code
- Mark to wait before applying damage and effects.
- REDIRECT Template:Code
- Defines the range along the view vector where entities can be reached.
- REDIRECT Template:Code
- Defines the range used when the user is in Creative mode.
- REDIRECT Template:Code
- Defines the extra tolerance in raycast for detecting entities.
- REDIRECT Template:Code
- Multiply the sum of the projected speeds.
- REDIRECT Template:Code
- Add to the multiplied sum of the projected speeds.
- REDIRECT Template:Code
- Conditions that must be met for the damage to be applied.
- REDIRECT Template:Code
- Conditions that must be met for repulsion to be applied.
- REDIRECT Template:Code
- Conditions that must be met for riders to be dismounted.
The fields available in
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr, and
- REDIRECT Template:Code
Template:Redr are:
- REDIRECT Template:Code
- Time, in ticks, during which the effect can be applied after the
- REDIRECT Template:Code
Template:Redr has elapsed.
- REDIRECT Template:Code
- Minimum user speed (projected onto the display vector via a dot product) required for the effect to be applied.
- REDIRECT Template:Code
- Minimum relative speed of the user relative to the target (projected onto the view vector via a dot product) required for the effect to be applied.
Example: <syntaxhighlight lang="json" copy> "minecraft:kinetic_weapon": {
"delay": 12,
"reach": {
"min": 2.0,
"max": 4.5
},
"creative_reach": {
"min": 2.0,
"max": 7.5
},
"hitbox_margin": 0.25,
"damage_multiplier": 0.95,
"damage_conditions": {
"max_duration": 225,
"min_relative_speed": 4.6
},
"knockback_conditions": {
"max_duration": 90,
"min_speed": 5.1
},
"dismount_conditions": {
"max_duration": 50,
"min_speed": 11.0
}
}
</syntaxhighlight>
minecraft:liquid_clipped
Determines whether an item interacts with liquid blocks when used. When interacting with liquid, outline selection cannot highlight any blocks below it. The interaction occurs within the liquid block, not on its sides.
It has no field, it must be a boolean value being either
- REDIRECT Template:Code
- REDIRECT Template:Code
Example: <syntaxhighlight lang="json" copy> "minecraft:liquid_clipped": true </syntaxhighlight>
minecraft:max_stack_size
Determines how many of the same item can be stacked.
The available fields are:
- There are no fields, it must be a number with a minimum of 1 and a maximum of 64.
Example: <syntaxhighlight lang="json" copy> "minecraft:max_stack_size": 64 </syntaxhighlight>
minecraft:piercing_weapon
This item component is used to replicate the jab attack used in Minecraft:spears. Allows the item to damage all entities detected in a straight line along the user's field of vision. Items with this component cannot destroy blocks, as the attack action always takes priority.
The available fields are:
- REDIRECT Template:Code
- Defines the range along the view vector where entities can be reached.
- REDIRECT Template:Code
- Defines the extra tolerance in raycast for detecting entities.
- REDIRECT Template:Code
- Defines the range used when the user is in Creative mode.
Example: <syntaxhighlight lang="json" copy> "minecraft:piercing_weapon": {
"reach": {
"min": 2.0,
"max": 4.5
},
"creative_reach": {
"min": 2.0,
"max": 7.5
},
"hitbox_margin": 0.25
} </syntaxhighlight>
minecraft:projectile
Projectile item component. Projectile items are fired like an arrow.
The available fields are:
- REDIRECT Template:Code
- Sets the time a projectile needs to charge to cause a critical hit.
- REDIRECT Template:Code
- The entity to fire as a projectile. If no namespace is specified, it is assumed to be
- REDIRECT Template:Code
Template:Redr. Example: <syntaxhighlight lang="json" copy> "minecraft:projectile": {
"minimum_critical_power": 1.25, "projectile_entity": "arrow"
} </syntaxhighlight>
minecraft:rarity
Represents the item's difficulty to obtain by changing the color of its name text. This component has no effect if [[#minecraft:hover_text_color|
- REDIRECT Template:Code
Template:Redr]] is also applied. The item's rarity will be increased if it is enchanted. See rarity for vanilla values.
It has no field, it must be a string value being
- REDIRECT Template:Code
Template:Redr for the white name,
- REDIRECT Template:Code
Template:Redr for the yellow name,
- REDIRECT Template:Code
Template:Redr for the aqua blue name and
- REDIRECT Template:Code
Template:Redr for the light purple name.
Example: <syntaxhighlight lang="json" copy> "minecraft:rarity": "rare" </syntaxhighlight>
minecraft:record
Allows the item to play a sound like a music disc when used in a Minecraft:jukebox, when used the item always turns its name color to aqua blue.
The available fields are:
- REDIRECT Template:Code
- Redstone signal intensity for use in comparator blocks can be any value including negative values, but only values from
- REDIRECT Template:Code
Template:Redr work.
- REDIRECT Template:Code
- Duration of the sound event in seconds, can be any value.
- REDIRECT Template:Code
- Sound event type, if it is a sound from a vanilla music album, the name of the album's author will be added, only vanilla sound events are allowed for use.
Example: <syntaxhighlight lang="json" copy> "minecraft:record": {
"comparator_signal": 1, "duration": 5, "sound_event": "ambient.tame"
} </syntaxhighlight>
minecraft:repairable
Determines which items can be used to repair a specified item, as well as the amount of durability the specified items will repair. By default, any item that has durability can be repaired by itself; setting it to repair in this component will override the vanilla calculation.
The available fields are:
- REDIRECT Template:Code
Template:Redr: List of item entries to repair.
- REDIRECT Template:Code
- How much durability is repaired, can be an integer value or a Minecraft:Molang expression, being able to use
- REDIRECT Template:Code
Template:Redr and
- REDIRECT Template:Code
Template:Redr to get the second slot.
- REDIRECT Template:Code
- The item used to repair the item that has the component.
Example: <syntaxhighlight lang="json" copy> "minecraft:repairable":{
"repair_items": [
{
"items":[
"minecraft:diamond"
],
"repair_amount": 10
},
{
"items":[
"minecraft:stick"
],
"repair_amount": "math.random(1,10)"
},
{
"items":[
"minecraft:apple"
],
"repair_amount": "math.min(q.remaining_durability + c.other->q.remaining_durability + math.floor(q.max_durability /20), c.other->q.max_durability)"
}
]
} </syntaxhighlight>
minecraft:shooter
Used to shoot projectiles like a Minecraft:bow. Must have the [[#minecraft:use_modifiers|
- REDIRECT Template:Code
Template:Redr]] component to work properly.
The available fields are:
- REDIRECT Template:Code
Template:Redr: Input list used to set ammunition and priority.
- REDIRECT Template:Code
- Indicates the item identifier. The item must have the component [[#minecraft:projectile|
- REDIRECT Template:Code
- REDIRECT Template:Code
- Can be
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr, allows the ammunition to be used in the offhand.
- REDIRECT Template:Code
- Can be
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr, determines whether it is possible to search for ammunition in the inventory, mandatory to be
- REDIRECT Template:Code
Template:Redr in survival and in creative if
- REDIRECT Template:Code
- REDIRECT Template:Code
- REDIRECT Template:Code
- Can be
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr, allows the ammo to be used in creative.
- REDIRECT Template:Code
- Can be
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr, defines whether the item is carried when drawn, if the item uses [[#minecraft:use_modifiers|
- REDIRECT Template:Code
Template:Redr]] it must have
- REDIRECT Template:Code
Template:Redr greater than or equal to
- REDIRECT Template:Code
- REDIRECT Template:Code
- Determines how long the weapon can be drawn before it is automatically released.
- REDIRECT Template:Code
- It can be
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr, when
- REDIRECT Template:Code
Template:Redr the longer the weapon is drawn, the more power it will have when released. Example: <syntaxhighlight lang="json" copy> "minecraft:shooter": {
"ammunition": [
{
"item": "custom_projectile",
"use_offhand": true,
"search_inventory": true,
"use_in_creative": true
}
],
"max_draw_duration": 1.0,
"scale_power_by_draw_duration": true,
"charge_on_draw": false
} </syntaxhighlight>
minecraft:should_despawn
Determines whether an item should eventually despawn while floating in the world.
It has no field, it must be a boolean value being either
- REDIRECT Template:Code
- REDIRECT Template:Code
Example: <syntaxhighlight lang="json" copy> "minecraft:should_despawn": true </syntaxhighlight>
minecraft:stacked_by_data
Determines whether the same item with different auxiliary values can be stacked. Additionally, it determines whether the item's actors can be merged while floating in the world.
It has no field, it must be a boolean value being either
- REDIRECT Template:Code
- REDIRECT Template:Code
Example: <syntaxhighlight lang="json" copy> "minecraft:stacked_by_data": true </syntaxhighlight>
minecraft:storage_item
Allows the item to act as a container and store other items as a Minecraft:bundle. The item must not stack for this component to work.
The available fields are:
- REDIRECT Template:Code
- Determines whether other storage items can be placed in the container can be
- REDIRECT Template:Code
- REDIRECT Template:Code
- REDIRECT Template:Code
- Defines the items that are allowed exclusively in the container. If empty or omitted, all items are allowed in the container.
- REDIRECT Template:Code
- Defines items that are not allowed exclusively in the container.
- REDIRECT Template:Code
- Sets the number of slots in the container to a minimum of 1 and a maximum of 64.
- REDIRECT Template:Code
- An integer.
Example: <syntaxhighlight lang="json" copy> "minecraft:storage_item": {
"max_slots": 64,
"allow_nested_storage_items": true,
"banned_items": [
"minecraft:shulker_box",
"minecraft:undyed_shulker_box"
]
} </syntaxhighlight>
minecraft:storage_weight_limit
Sets the maximum allowed total weight of all items in the storage item container. The item must have the [[#minecraft:storage_item|
- REDIRECT Template:Code
Template:Redr]] component for this component to work.
- To calculate the weight of an item, divide 64 by the maximum number of stacked items. If there are 64, each item weighs 1. If there are 16, each item weighs 4. If there are 1, each item weighs 64.
The available fields are:
- REDIRECT Template:Code
- An integer.
Example: <syntaxhighlight lang="json" copy> "minecraft:storage_weight_limit": {
"max_weight_limit": 64
} </syntaxhighlight>
minecraft:storage_weight_modifier
Sets the additional weight the item adds when it is inside another storage item.
The available fields are:
- REDIRECT Template:Code
- An integer between 0 and 64 a value of 0 does not allow the item to be used in a storage item.
Example: <syntaxhighlight lang="json" copy> "minecraft:storage_weight_modifier": {
"weight_in_storage_item": 4
} </syntaxhighlight>
minecraft:swing_duration
Determines the duration, in seconds, of the player's arm swing animation when drawing, attacking, or using an item. It only affects the visuals and does not impact the frequency of attacks or the game mechanics.
The available fields are:
- REDIRECT Template:Code
- The duration in seconds of the arm's swing.
Example: <syntaxhighlight lang="json" copy> "minecraft:swing_duration": {
"value": 1.05
} </syntaxhighlight>
minecraft:swing_sounds
Allows you to cancel user-generated swing sounds and emit sounds defined in the component; only vanilla sounds are allowed for use.
The available fields are:
- REDIRECT Template:Code
- Sound played when an attack misses or does not cause damage due to invulnerability.
- REDIRECT Template:Code
- Sound played when an attack hits.
- REDIRECT Template:Code
- Sound played when an attack hits and deals critical damage.
Example: <syntaxhighlight lang="json" copy> "minecraft:swing_sounds": {
"attack_miss": "item.spear.attack_miss", "attack_hit": "item.spear.attack_hit"
} </syntaxhighlight>
minecraft:tags
Sets the tag for an item, which can be vanilla or custom, for the list of vanilla tags see item tag.
The available fields are:
- REDIRECT Template:Code
- List of tags that the item has.
Example: <syntaxhighlight lang="json" copy> "minecraft:tags": {
"tags": [
"custom_tag"
]
} </syntaxhighlight>
minecraft:throwable
Defines throwable items, such as a Minecraft:snowball. The item must have the [[#minecraft:projectile|
- REDIRECT Template:Code
Template:Redr]] component otherwise it will not work.
The available fields are:
- REDIRECT Template:Code
- Whether the item should use the arm swing animation when thrown can be either
- REDIRECT Template:Code
- REDIRECT Template:Code
- REDIRECT Template:Code
- The scale at which the throwing power increases, which can be negative, ending up throwing the item in the opposite direction.
- REDIRECT Template:Code
- The maximum time to throw the throwable item, it can be negative if it is negative it throws instantly.
- REDIRECT Template:Code
- The maximum power to throw the throwable item, which can be negative.
- REDIRECT Template:Code
- The minimum time to throw the throwable item, can be negative if it is negative it throws instantly.
- REDIRECT Template:Code
- Whether or not the power of the throw increases with the duration of the charge. It can be
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr, if it is
- REDIRECT Template:Code
Template:Redr it will take the time into consideration, that is, the longer you hold it, the more power it will have when thrown. Example: <syntaxhighlight lang="json" copy> "minecraft:throwable": {
"do_swing_animation": false, "launch_power_scale": 1.0, "max_draw_duration": 0.0, "max_launch_power": 1.0, "min_draw_duration": 0.0, "scale_power_by_draw_duration": false
} </syntaxhighlight>
minecraft:use_animation
Defines which animation will happen when using the item.
The available fields are:
- There are no fields, it must be a string value and can be
- REDIRECT Template:Code
- REDIRECT Template:Code
- REDIRECT Template:Code
- REDIRECT Template:Code
- REDIRECT Template:Code
- REDIRECT Template:Code
- REDIRECT Template:Code
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr and
- REDIRECT Template:Code
Template:Redr. Example: <syntaxhighlight lang="json" copy> "minecraft:use_animation": "eat" </syntaxhighlight>
minecraft:use_modifiers
Modifies usage effects, including the time it takes for an item to be used and the player's speed when used in combination with components such as Shooter, Throwable, or Food.
The available fields are:
- REDIRECT Template:Code
- Modifier value to scale players' movement speed when the item is in use, sensing a value between 0 and 1.
- REDIRECT Template:Code
- How long in seconds it takes to use the item.
- REDIRECT Template:Code
- Controls whether an item vibrates when it starts or stops being used; can be
- REDIRECT Template:Code
- REDIRECT Template:Code
- REDIRECT Template:Code
- Defines the sound to be played when starting to use the item only vanilla sounds are allowed for use.
Example: <syntaxhighlight lang="json" copy> "minecraft:use_modifiers": {
"movement_modifier": 0.5, "use_duration": 1.0, "emit_vibrations": false, "start_sound": "item.spear.use"
} </syntaxhighlight>
minecraft:wearable
Determines where the item can be used. If any slot other than the hand slot is selected, the maximum item stack value is set to 1.
The available fields are:
- REDIRECT Template:Code
- Defines the slot in which the item can be used, which can be
- REDIRECT Template:Code
- REDIRECT Template:Code
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr and
- REDIRECT Template:Code
Template:Redr i.e. offhand, head, chestplate, leggings and feet. It is also used for the armor trim icon and for the tooltip to show the armor value.
- REDIRECT Template:Code
- How much protection the item will provide the player when used. Displayed in the item's tooltip.
- REDIRECT Template:Code
- Determines whether or not to hide the player's location on locator maps and in the locator bar when used. Can be either
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr. Example: <syntaxhighlight lang="json" copy> "minecraft:wearable": {
"slot": "slot.armor.chest", "protection": 10, "hides_player_location": false
} </syntaxhighlight>
Custom components
Custom item components allow for custom items to take advantage of script API capabilities. Custom components are registered in scripts using the method
- REDIRECT Template:Code
Custom components can be added to items the same way as any other component, using the namespaced Minecraft:identifier the component was registered with. Custom components can have arguments of any type, which will be passed to scripts as the second argument.
Examples: <syntaxhighlight lang=json copy> "example_namespace:example_component": "foo", "example_namespace:example_component2": 4, "example_namespace:example_component3": [ "hello", "world" ], "example_namespace:example_component4": true, "example_namespace:example_component5": {
"stuff": 4
} </syntaxhighlight>
In scripts, the custom component object can have methods added to listen to any amount of the following events<ref>Template:Cite</ref>:
- REDIRECT Template:Code
Template:Redr: Called when the item hits an entity and is about to take durability damage.
- REDIRECT Template:Code
Template:Redr: Called when the item's use duration was completed.
- REDIRECT Template:Code
Template:Redr: Called when the item is eaten by an entity.
- REDIRECT Template:Code
Template:Redr: Called when the item is used to hit an entity.
- REDIRECT Template:Code
Template:Redr: Called when the item is used to mine a block.
- REDIRECT Template:Code
Template:Redr: Called when the item is used by a player.
- REDIRECT Template:Code
Template:Redr: Called when the item is used on a block.
NBT Components
Item NBT components are a little different from regular components, they are stored internally by the game and can only be modified by commands like
- REDIRECT Template:Command
- REDIRECT Template:Command
Template:Redr much like Java Edition data components.
The available NBT components are
- REDIRECT Template:Code
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr and
- REDIRECT Template:Code
minecraft:can_place_on
Controls what types of blocks this block can be placed on. This allows blocks to be placed in adventure mode without the use of Minecraft:allow blocks.
Example: Template:Cmd
minecraft:can_destroy
Controls what types of blocks this item can destroy.
Example: Template:Cmd
minecraft:item_lock
Locks the item in the player's inventory depending on the chosen mode. Having the
- REDIRECT Template:Code
Template:Redr parameter that specifies the lock type. Which can be
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr.<ref>Template:Cite</ref>
lock_in_inventory
Prevents the item from being dropped, removed from inventory, used as a crafting ingredient, placed in a Minecraft:bundle, or renamed on an Minecraft:anvil. It displays a yellow triangle in the top corner of the item.
Example: Template:Cmd
lock_in_slot
Prevents the item from being moved or removed from its slot in the player's inventory, dropped, placed stacked, and used as a crafting ingredient. It displays a red triangle in the top corner of the item.
Example: Template:Cmd
keep_on_death
Prevents the item from being dropped when the entity dies.
Example: Template:Cmd
History
Template:Message boxTemplate:Article other Template:HistoryTable
References
<references group="">
</references>
External links
More information about components
ja:アイテムコンポーネント pt:Componentes de item zh:基岩版物品堆叠组件