Item Behaviours
Item behaviours define specific functionalities associated with items, blocks, and decorations.
All behaviours are optional, and some are mutually exclusive (e.g., trap, shoot, and instrument).
Example with some behaviours set:
Click to expand
{
"id": "mynamespace:multi_example",
"vanillaItem": "minecraft:paper",
"itemResource": {
"models": {
"default": "mynamespace:custom/misc/clown_horn",
"trapped": "mynamespace:custom/misc/clown_horn_trapped"
}
},
"behaviour": {
"instrument": {
"sound": "mynamespace:misc.honk",
"range": 64,
"useDuration": 60
},
"shoot": {
"consumes": false,
"baseDamage": 2.0,
"speed": 1.0,
"projectile": "minecraft:iron_axe",
"sound": "mynamespace:misc.shoot"
},
"armor": {
"slot": "head",
"texture": "mynamespace:texture_name"
},
"trap": {
"types": ["minecraft:villager", "minecraft:zombie", "minecraft:skeleton"],
"requiredEffects": ["minecraft:glowing"],
"chance": 75,
"useDuration": 0
},
"fuel": {
"value": 10
},
"food": {
"hunger": 2,
"saturation": 1.0,
"canAlwaysEat": true,
"fastfood": true
},
"cosmetic": {
"slot": "head",
"model": "mynamespace:custom/models/clown_backpack_animated",
"autoplay": "idle",
"scale": [1.5, 1.5, 1.5],
"translation": [0.0, 0.5, 0.0]
},
"execute": {
"consumes": true,
"command": "/summon minecraft:creeper ~ ~ ~ {powered:1b}",
"sound": "minecraft:block.anvil.place"
}
}
}
armor behaviour
Defines armour item behaviours, using the Fancypants shader via Polymer.
As of filament 0.7 it is possible to use armor trims to render custom armor, to enable this, set the trim flag to true.
- The textures for the shader version of armor should be located in
assets/minecraft/textures/models/armor/. - For a
texturefield value ofmynamespace:amethyst, the textures should be namedamethyst_layer_1.pngandamethyst_layer_2.png. - It's required to use a leather armor item for your
vanillaItemfor the shader to work.
- When using Armor Trims for the armor, the textures need to be located in
assets/minecraft/textures/trims/models/armor/. - For a
texturefield value ofmynamespace:amethyst, the textures should be namedamethyst.pngandamethyst_leggings.png. - It's required to use an armor item for your
vanillaItem. Any armor item should work. - Depending on the
vanillaItemof your custom item, you might be able to see parts of the original armors texture, to mitigate this, you will have to enable thetrimArmorReplaceChainmailoption in the mods configs. - Enabling
trimArmorReplaceChainmailwill prevent all chainmail armor pieces unable to receive or display armor trims. The Smithing Table will also reject chainmail armor with this option enabled.
slot: The equipment slot for the armour piece (e.g., head, chest, legs, or feet).texture: The resource location of the texture associated with the armour. Example:mynamespace:amethysttrim: Flag whether to use trim-based armor instead of shaders
compostable behaviour
Makes the item usable in composters.
chance: Chance of raising the composter level by 1 between 0 and 100villagerInteraction: Allows farmer villagers to compost the item. Defaults totrue
cosmetic behaviour
Defines cosmetic item behaviour for either the head or chestplate slot, supporting both Blockbench models for chestplates and simple item models for either slot.
slot: The equipment slot for the cosmetic (head or chest).model: Optional, the resource location of the animated blockbench or animated-java model for the cosmetic.autoplay: Optional, the name of the animation to autoplay, which should be loopable.scale: Scale of the chest cosmetic, defaulting to (1, 1, 1).translation: Translation of the chest cosmetic, defaulting to (0, 0, 0).
item_interact_execute behaviour
Executes a command on item use with the player as source, located at the player, with elevated permissions.
consumes: Flag whether the item is consumed after running the command(s). Defaults tofalsecommand: The command string to execute. Empty by defaultcommands: List of commands to execute. Empty by defaultsound: Optional sound effect to play during execution. Empty by default
item_attack_execute behaviour
Executes a command when an entity is attacked with the item or when swinging at air, located at the player, with elevated permissions.
consumes: Flag whether the item is consumed after running the command(s). Defaults tofalsecommand: The command string to execute. Empty by defaultcommands: List of commands to execute. Empty by defaultsound: Optional sound effect to play during execution. Empty by defaultonEntityAttack: true/false flag whether to execute only when an entity was attacked. Otherwise the command will also be executed when the item is "swung" by the player. Default totrue
food behaviour
Defines food item behaviour for edible items.
hunger: The amount of hunger restored when consumed. Defaults to1saturation: The saturation modifier provided by the food. Defaults to0.6canAlwaysEat: Indicates whether the item can be eaten when the hunger bar is full. Defaults tofalsefastfood: Boolean indicating whether the food item is considered fast food (eats faster than normal). Defaults tofalse
villager_food behaviour
Makes the item edible for villagers (for villager breeding).
value: The amount of "breeding power" the item has (1 = normal food item, 4 = bread). Defaults to1
fuel behaviour
Defines fuel behaviour for items, specifying their value used in furnaces and similar item-burning blocks.
value: The value associated with the fuel, determining burn duration. Defaults to10
hoe behaviour
Gives the item the ability to till farmland, like vanilla hoes do, using 1 durability.
sound: Sound to play. Default to the vanilla hoe tilling soundminecraft:item.hoe.till
shovel behaviour
Gives the item the ability to change blocks to path blocks, like vanilla shovels do, using 1 durability.
shears behaviour
Gives the item the ability to shears blocks & plants, like vanilla shears do, using 1 durability.
instrument behaviour
Defines instrument behaviour for items, similar to goat horns.
sound: The sound associated with the instrument. Empty by defaultrange: The range of the instrument. Defaults to0useDuration: Delay in ticks for using the instrument. Defaults to0
stripper behaviour
Gives the item the ability to strip Logs/scrape copper blocks, like an axe. Uses 1 durability.
Fields:
sound: Sound to play. Default to the vanilla axe strip sound
trap behaviour
Defines trap behaviour for items capable of trapping specific entity types.
types: List of allowed entity types to trap. Example:["minecraft:silverfish", "minecraft:spider"]requiredEffects: List of required effects for the trap. Example:["minecraft:weakness"]chance: Chance of the trap triggering (0-100). Defaults to50useDuration: Use cooldown for the trap item. Defaults to0
banner_pattern behaviour
Allows you to assign a banner pattern to an item for use in Looms.
See the mynamespace:bannertestitem item config in the example datapack in the GitHub repo.
bow behaviour
Vanilla-like bow behaviour. Lets you specify which item can be shot, but anything that is not an arrow or firework rocket will render as normal arrow. Allows to specify a power multiplier for shooting power. Supports firework rockets.
Make sure to use minecraft:bow as vanillaItem in order for the item model overrides to work properly!
powerMultiplier: The power multiplier. Defaults to3supportedProjectiles: List of supported items in the inventory for use with the bow. Defaults to["minecraft:arrow", "minecraft:spectral_arrow"]supportedHeldProjectiles: List of supported items for use when in main/offhand. Defaults to["minecraft:arrow", "minecraft:spectral_arrow", "minecraft:firework_rocket"]shootSound: The sound when shooting a projectile. Default tominecraft:entity.arrow.shoot
This behaviour can automatically generate the item model predicate overrides for bows (item assets in `items` in 1.21.4).
In order to automatically generate an item model for bows, you have to provide models for default, pulling_0, pulling_1 and pulling_2 in the itemResource field:
{
"itemResource": {
"models": {
"default": "minecraft:custom/bow/custombow",
"pulling_0": "minecraft:custom/bow/custombow_pulling_0",
"pulling_1": "minecraft:custom/bow/custombow_pulling_1",
"pulling_2": "minecraft:custom/bow/custombow_pulling_2"
}
}
}
Alternatively, you can use the itemModel field to provide your own item asset model
crossbow behaviour
Vanilla-like crossbow behaviour. Lets you specify which item can be shot, but anything that is not an arrow or firework rocket will render as normal arrow. Allows to specify a power multiplier for shooting power.
Make sure to use minecraft:crossbow as vanillaItem in order for the item model overrides to work properly!
This behaviour can automatically generate the item model predicate overrides for crossbows (item assets in items in 1.21.4).
In order to automatically generate an item model for crossbows, you have to provide models for default, pulling_0, pulling_1, pulling_2, arrow and rocket in the itemResource field:
{
"itemResource": {
"models": {
"default": "minecraft:custom/crossbow/crossy1", // model without projectile
"pulling_0": "minecraft:custom/crossbow/crossy1_pulling_0",
"pulling_1": "minecraft:custom/crossbow/crossy1_pulling_1",
"pulling_2": "minecraft:custom/crossbow/crossy1_pulling_2",
"arrow": "minecraft:custom/crossbow/crossy1_arrow", // model with projectile
"rocket": "minecraft:custom/crossbow/crossy1_rocket" // model with projectile
}
}
}
Alternatively, you can use the itemModel field to provide your own item asset model.
powerMultiplier: The power multiplier. Defaults to1supportedProjectiles: List of supported items in the inventory for use with the crossbow. Defaults to["minecraft:arrow", "minecraft:spectral_arrow"]supportedHeldProjectiles: List of supported items for use when in main/offhand. Defaults to["minecraft:arrow", "minecraft:spectral_arrow", "minecraft:firework_rocket"]shootSound: The sound when shooting a projectile. Default tominecraft:item.crossbow.shootloadingStartSound: Projectile loading start sound. Default tominecraft:item.crossbow.loading_startloadingMiddleSound: Projectile loading middle sound. Default tominecraft:item.crossbow.loading_middleloadingEndSound: Projectile loading end sound. Default tominecraft:item.crossbow.loading_end
shoot behaviour
Defines behaviour for items capable of shooting custom projectiles or being shot themselves.
consumes: Indicates whether shooting consumes the item. Defaults tofalsebaseDamage: The base damage of the projectile. Defaults to2.0speed: The speed at which the projectile is fired. Defaults to1.0projectile: The identifier for the projectile item. Empty by defaultsound: Optional sound effect to play when shooting. Empty by defaulttranslation: Translation offset for the projectile. Defaults to[0 0 0]rotation: Rotation for the projectile. Defaults to[0 90 0]scale: Scale for the projectile. Defaults to0.6
shield behaviour
Makes the item usable as shield.
This behaviour can automatically generate the item model predicate overrides for shields (item assets in items in 1.21.4).
In order to automatically generate an item model for shields, you have to provide models for default and blocking in the itemResource field:
{
"itemResource": {
"models": {
"default": "minecraft:custom/shield/shield1",
"blocking": "minecraft:custom/shield/shield1_blocking"
}
}
}
Alternatively, you can use the itemModel field to provide your own item asset model
fishing_rod behaviour
Makes the item behave like a fishing rod!
This behaviour can automatically generate the item model predicate overrides for fishing rods (item assets in items in 1.21.4).
In order to automatically generate an item model for fishing rods, you have to provide models for default and cast in the itemResource field:
{
"itemResource": {
"models": {
"default": "minecraft:custom/rod/fire_rod",
"cast": "minecraft:custom/rod/fire_rod_cast"
}
}
}
Alternatively, you can use the itemModel field to provide your own item asset model
trident behaviour
Makes the item behave like a trident!
This behaviour can automatically generate the item model predicate overrides for tridents.
In order to automatically generate an item model for tridents, you will have to provide models for default and cast in the itemResource field:
{
"itemResource": {
"models": {
"default": "minecraft:custom/trident/nether_trident",
"throwing": "minecraft:custom/trident/nether_trident_throwing"
}
}
}
Alternatively, you can use the itemModel field to provide your own item asset model
mace behaviour
Makes the item behave like a mace!
enchantable behaviour
Backport of the minecraft:enchantable component introduced in 1.21.2, only available for 1.21.1.
repairable behaviour
Backport of the minecraft:repairable component introduced in 1.21.2, only available for 1.21.1.