搬运一批Bedrock wiki内容,完善翻译

This commit is contained in:
boybook
2025-03-20 00:13:44 +08:00
parent ead7392a76
commit 4896c1a4f2
163 changed files with 33930 additions and 1464 deletions

View File

@@ -0,0 +1,251 @@
---
title: Attachables
category: Documentation
tags:
- beginner
mentions:
- Sprunkles317
- MedicalJewel105
- AdamRaichu
- Luthorius
- TheItsNameless
---
::: tip
This document assumes you have a basic understanding of Molang, render controllers, animations, and client entity definitions. Ensure you are familiar with the basics of [client entities](/entities/entity-intro-rp)!
:::
## Introduction
When we design a custom item or block, Minecraft will build a model from a template so the item can be displayed when held. This takes the form of the item's sprite being an extruded texture mesh, or blocks displaying with their model. By using a system called **attachables** we can design our own models to be displayed when these items are held.
Ever wanted sticks to look like spyglasses? Or to wield a big chainsaw with a spinning chain? Attachables are the way to accomplish that!
This document covers **two different ways** to create attachables, depending on how the geometry being used is constructed.
## Overview
Attachables are a system of rendering entity models when an item or block is equipped. This means having the item held in the main hand, off hand, or armor slots.
Attachable definitions are quite similar in design to client entity definitions; they let us define textures, materials, geometries, and animations to display the attachable.
### File Structure
The attachable definition goes within the 'attachables' folder. The file layout is otherwise identical to that of custom entities.
<FolderView
:paths="[
'RP/animations/my_item.animation.json',
'RP/attachables/my_item.entity.json',
'RP/models/entity/my_item.geo.json',
'RP/textures/entity/my_item.png',
'RP/manifest.json'
]"
></FolderView>
### Attachable Definition
Here's a basic example of an attachable.
<CodeHeader>RP/attachables/stick.entity.json</CodeHeader>
```json
{
"format_version": "1.10.0",
"minecraft:attachable": {
"description": {
"identifier": "minecraft:stick",
"materials": {
"default": "entity",
"enchanted": "entity_alphatest_glint"
},
"textures": {
"default": "textures/entity/steve",
"enchanted": "textures/misc/enchanted_item_glint"
},
"geometry": {
"default": "geometry.wiki.steve_head"
},
"animations": {
"hold_first_person": "animation.steve_head.hold_first_person",
"hold_third_person": "animation.steve_head.hold_third_person"
},
"scripts": {
"animate": [
{
"hold_first_person": "context.is_first_person == 1.0"
},
{
"hold_third_person": "context.is_first_person == 0.0"
}
]
},
"render_controllers": [
"controller.render.item_default"
]
}
}
}
```
A few key things to point out with this attachable definition:
- The identifier matches an existing block or item ID. This will activate the attachable when the item is equipped, and will replace the original model that appears when held.
- There is a material and texture listed for the enchantment glint. This is important to keep around if your item should have the glint when enchanted.
Making attachables is a little more involved than making a client entity file. We need to properly rig the geometry's skeleton so that it looks correct when equipped.
## Method 1 - Attached to the Skeleton
<Label name="Beginner" color="blue"></Label>
In this first method we will construct the attachable using a copy of the player's skeleton, by attaching your model to one of the player's bones.
This solution is ideal for models that are intended for scenarios involving only one type of mob/entity, especially players; and involving only one equipment slot. It is easy to view what the model will look like in Blockbench.
### Setting up the Skeleton
We need to reconstruct the player's skeleton in order for our model to be parented to the correct bone, otherwise it will not be parented to anything and will float freely on the player.
With a text editor, take the bones from the provided player skeleton file and copy them to your geometry file, then set the `rightItem` bone as the parent to the cubes from your model. Save this geometry to your resource pack.
For convenience, such a model has been prepared here. The cubes from the player's model have already been removed:
<BButton
link="https://github.com/Bedrock-OSS/bedrock-wiki/blob/wiki/docs/public/assets/packs/tutorials/attachables/method_one/steve_head.geo.json?raw=true"
color=blue
>📄 Geometry File</BButton>
### Display Settings
Having your model floating at the player's feet is not ideal. Our next step is to create animations so we can properly display the model on the player.
Create two new animations, one for holding the item in first person and another for holding it in third person. Select your third-person animation, and position it however you want. Save this animation to your resource pack.
Here is an example of such an animation. This also includes a first-person animation—the means of making one is detailed in the section below.
<BButton
link="https://github.com/Bedrock-OSS/bedrock-wiki/blob/wiki/docs/public/assets/packs/tutorials/attachables/method_one/steve_head.animation.json?raw=true"
color=blue
>📄 Animation File</BButton>
### First-person Animations
To more easily create first-person animations, we need to mimic how the arm is positioned in the first person.
:::tip
To add animation for player's hands, you need to use player's animations, not attachables animations.
:::
Use the following guide animation and import it into Blockbench. It applies a rotation of (95, -45, 115) and a translation of (13.5, -10, 12) to the right arm bone, perfectly mimicking how the arm is positioned in first-person.
<BButton
link="https://github.com/Bedrock-OSS/bedrock-wiki/blob/wiki/docs/public/assets/packs/tutorials/attachables/method_one/attachable_guide.animation.json?raw=true"
color=blue
>📄 Attachable Guide File</BButton>
:::warning NOTE
This is where things get tricky. Both animations will need to be played simultaneously; your first-person animation, and the guide's first-person animation.
Be sure you are editing your animation when making your changes. Select it first, then play the guide's first-person animation on top.
:::
### Conclusion
With this all set up, go through and delete the *cubes* from the player skeleton if there are any, but keep the bones. Check the model out in-game!
## Method 2 - Bound to a Bone
<Label name="Intermediate" color="orange"></Label>
In this second method, the attachable geometry will be constructed using model binding. This allows a model to be directly attached to a bone within a mob's geometry corresponding to the slot it is equipped in. Minecraft employs model binding for its attachable items, including the trident, spyglass, bow, and shield.
While this method allows the attachable to apply more dynamically to other mobs and equipment slots, model binding also has strange quirks, which will be illustrated below. Some developers may find this method trickier to get working.
### Model Binding
Our first step is to upgrade the model file format version to `"1.16.0"` if it is not already. If the model is a legacy file, then convert it before continuing; Blockbench has a tool to do this (File → Convert Project).
Next up is modifying the root bone of our geometry to be bound to the equipment slot the item is placed in. Take note of line 4 in this excerpt from the skeleton head geometry file:
<CodeHeader>RP/models/entity/skeleton_head.geo.json</CodeHeader>
```json
// A bone
{
"name": "skeleton_head",
"binding": "q.item_slot_to_bone_name(context.item_slot)",
"pivot": [0, 4, 0],
"cubes": [
{
"origin": [-4, 0, -4],
"size": [8, 8, 8],
"uv": [0, 0]
}
]
}
```
The `"parent"` key in a bone accepts a string, and whichever bone name is entered will be set as the parent to the current bone; the child bones keep their positions but move relative to the parent bone.
The `"binding"` key on the other hand accepts Molang, and the pivot point of whichever bone name is entered is set as the *root position* that the child bone and its children should inherit.
For the value of `"binding"` we are using the Molang query `q.item_slot_to_bone_name`, which converts a slot name to a bone name, with the contextual variable `context.item_slot` as an argument. This converts the name of the equipment slot this item resides in to its corresponding bone name in the player's geometry. The conversions are as follows:
- `'main_hand'` → "rightitem"
- `'off_hand'` → "leftitem"
Apply the model binding to your bone, and save the geometry to your resource pack.
An example model with this binding applied is provided here:
<BButton
link="https://github.com/Bedrock-OSS/bedrock-wiki/blob/wiki/docs/public/assets/packs/tutorials/attachables/method_two/skeleton_head.geo.json?raw=true"
color=blue
>📄 Geometry File</BButton>
### Display Settings
With that done, the next step is to set up animations to display the model in first person and third person.
Create two new animations, one for holding the item in first person and another for holding it in third person.
To make creating these animations easier, please do the following:
- Download the following player skeleton model. We will use this as a visual aid for positioning your model.
<BButton
link="https://github.com/Bedrock-OSS/bedrock-wiki/blob/wiki/docs/public/assets/packs/tutorials/attachables/method_two/player_skeleton.geo.json?raw=true"
color=blue
>📄 Player Skeleton File</BButton>
- With a text editor, add the bones and cubes from your model to the player skeleton model, then import the player skeleton model into Blockbench.
- Set your model's root bone(s) to be a child of the 'rightItem' bone in the player skeleton.
- Download the following animation file import the `wiki.third_person_guide` animation. This will be used later to make positioning easier.
<BButton
link="https://github.com/Bedrock-OSS/bedrock-wiki/blob/wiki/docs/public/assets/packs/tutorials/attachables/method_two/attachable_guide.animation.json?raw=true"
color=blue
>📄 Attachable Guide File</BButton>
These guide animations have one notable feature: they apply a -24 offset to the y-position of the right item bone to counteract a similar -24 y-position offset Minecraft applies to bound bones. We are unsure at this time why this happens.
:::warning NOTE
Similar to Method One, **two** animations will need to be played simultaneously for correct positioning.
Be sure you are editing your animations when making your changes. Select it first, then play the guide animation on top.
:::
Play both animations, and position your model however you want. Save the animations to your resource pack.
An example animation file for this positioning:
<BButton
link="https://github.com/Bedrock-OSS/bedrock-wiki/blob/wiki/docs/public/assets/packs/tutorials/attachables/method_two/skeleton_head.animation.json?raw=true"
color=blue
>📄 Animation File</BButton>
### First-person Animations
Similar to the third-person animation, look in the Attachable Guide file and import the `wiki.first_person_guide` animation into Blockbench. Play both your animation and the guide's first-person animation together, then make your changes and save the file.
## Example Pack
Each of these methods have been compiled into an example pack you may reference, for if you are getting stuck or simply want to see a working example.
<BButton
link="https://github.com/Bedrock-OSS/wiki-addon/releases/download/download/attachable-example.mcpack"
color=blue
>💾 Example Pack</BButton>

View File

@@ -0,0 +1,562 @@
---
title: Custom Armor
category: Tutorials
tags:
- experimental
mentions:
- SirLich
- Dreamedc2015
- sermah
- yanasakana
- Joelant05
- MedicalJewel105
- aexer0e
- Brougud
- XxPoggyisLitxX
- LeGend077
- SmokeyStack
---
::: tip
It is highly recommended that you look over [the BlockBench modelling and texturing](/guide/blockbench) section in the beginners guides before tackling these sections.
:::
Making custom armors is surprisingly easy to do, you need to do a bit of fiddling around as there are a few files that need to be added and there can be a little bit of texturing involved but you can do as much or as little as you want here.
## Chest Piece
Create a chest piece:
<CodeHeader>BP/items/my_chest.json</CodeHeader>
```json
{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "wiki:my_chest",
// Notice we give it the equipment category
"category": "equipment"
},
"components": {
// Make sure it appears within the chestplate category
"minecraft:creative_category": {
"parent": "itemGroup.name.chestplate"
},
// The icon we want to use in our INVENTORY
"minecraft:icon": {
"texture": "my_chest"
},
// We give it a name
"minecraft:display_name": {
"value": "My Custom Armor"
},
// We dont want it to stack
"minecraft:max_stack_size": 1,
// We make sure it can only receive enchantments for chest pieces
"minecraft:enchantable": {
"value": 10,
"slot": "armor_torso"
},
// This tells it how much protection it should give
"minecraft:armor": {
"protection": 5
},
// We want it to be repairable, and what to use to repair it
"minecraft:repairable": {
"repair_items": [
{
"items": ["minecraft:stick"],
"repair_amount": "context.other->q.remaining_durability + 0.05 * context.other->q.max_durability"
// Some complicated molang; just copy it
}
]
},
// Mark it as a wearable and that it goes in the chest slot
"minecraft:wearable": {
"dispensable": true,
"slot": "slot.armor.chest"
},
// Provide its durability
"minecraft:durability": {
"max_durability": 200
}
}
}
}
```
At this point you could just go and add an item texture into your `RP/textures/item_texture.json` with the key `my_chest` and you are on your way. We have attached a default item texture for your armor here if you want to just follow along.
![](/assets/images/tutorials/custom-armor/custom_chestplate.png)
<BButton link="https://raw.githubusercontent.com/Bedrock-OSS/bedrock-wiki/wiki/docs/public/assets/images/tutorials/custom-armor/custom_chestplate.png">Download texture here</BButton>
## Adding attachables and textures
At this point your item would appear in game and would be wearable but it would not have any appearance. This is because we need to tell it how to handle the attachable equipment and give it a texture to show.
To start with you need to create an `attachables` folder in your RP (you may already have one).
<CodeHeader>RP/attachables/my_chest.json</CodeHeader>
```json
{
"format_version": "1.8.0",
"minecraft:attachable": {
"description": {
"identifier": "wiki:my_chest",
// These 2 are default and are required
"materials": {
"default": "armor",
"enchanted": "armor_enchanted"
},
"textures": {
// This is our CUSTOM armor texture we need to make next
"default": "textures/models/armor/custom_main",
// This texture doesn't actually exist in our RP
// but it will blow up without it so leave it in
"enchanted": "textures/misc/enchanted_item_glint"
},
// We tell it what geometry to use for the chestplate
"geometry": {
"default": "geometry.player.armor.chestplate"
},
// We tell it to hide the chest layer as we will be showing our armor on top
"scripts": {
"parent_setup": "v.chest_layer_visible = 0.0;"
},
// We tell it what controller to use (default armor one)
"render_controllers": ["controller.render.armor"]
}
}
}
```
At this point we need to make sure we create a texture for our model, these live in `RP/textures/models/armor`. We however actually need 2 textures, as one is for the main armor as if it is being worn all together, and one is for the legs which when worn alone will often cover some of the boot area.
If you do not feel creative we have provided a recoloured diamond armour skin for use with this tutorial. So just `Save As` and plop them in the folder.
![](/assets/images/tutorials/custom-armor/custom_main.png)
<BButton link="https://raw.githubusercontent.com/Bedrock-OSS/bedrock-wiki/wiki/docs/public/assets/images/tutorials/custom-armor/custom_main.png">Download texture here</BButton>
![](/assets/images/tutorials/custom-armor/custom_legs.png)
<BButton link="https://raw.githubusercontent.com/Bedrock-OSS/bedrock-wiki/wiki/docs/public/assets/images/tutorials/custom-armor/custom_legs.png">Download texture here</BButton>
> In the real world you would probably want to use `BlockBench` or some photo editing program to edit the textures and ideally see how they look on a model before you add them into the addon.
> If you now go into the game and check what you have produced you should be able to wear your chest piece and pat yourself on the back for a job well done.
![](/assets/images/tutorials/custom-armor/armor-item-image.jpg)
![](/assets/images/tutorials/custom-armor/armor-model-image.jpg)
## Leggings
So while the chest piece alone is great, you probably want a whole set, so from here if you make another item json for the boots like so.
<CodeHeader>BP/items/my_leggings.json</CodeHeader>
```json
{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "wiki:my_leggings",
"category": "equipment"
},
"components": {
// We give it the leggings category this time
"minecraft:creative_category": {
"parent": "itemGroup.name.leggings"
},
// Give it an applicable ITEM texture
"minecraft:icon": {
"texture": "my_leggings"
},
"minecraft:display_name": {
"value": "My Custom Leggings"
},
"minecraft:max_stack_size": 1,
// Make sure the enchantments are for legs
"minecraft:enchantable": {
"value": 10,
"slot": "armor_legs"
},
"minecraft:armor": {
"protection": 3
},
"minecraft:repairable": {
"repair_items": [
{
"items": ["minecraft:stick"],
"repair_amount": "context.other->q.remaining_durability + 0.05 * context.other->q.max_durability"
}
]
},
// Make sure the wearable slot is legs
"minecraft:wearable": {
"dispensable": true,
"slot": "slot.armor.legs"
},
"minecraft:durability": {
"max_durability": 200
}
}
}
}
```
This is great and like before you will need to add your own item texture, although here is one if you just want to continue.
![](/assets/images/tutorials/custom-armor/custom_leggings.png)
<BButton link="https://raw.githubusercontent.com/Bedrock-OSS/bedrock-wiki/wiki/docs/public/assets/images/tutorials/custom-armor/custom_leggings.png">Download texture here</BButton>
Once we are done here we need to create the attachables file like this:
<CodeHeader>RP/attachables/my_leggings.json</CodeHeader>
```json
{
"format_version": "1.8.0",
"minecraft:attachable": {
"description": {
"identifier": "wiki:my_leggings",
// Notice this is the same as before
"materials": {
"default": "armor",
"enchanted": "armor_enchanted"
},
"textures": {
// Same as before
"enchanted": "textures/misc/enchanted_item_glint",
// This one is different as we are using the legging specific texture
"default": "textures/models/armor/custom_legs"
},
// Tell it to use leggings geom
"geometry": {
"default": "geometry.humanoid.armor.leggings"
},
// Hide legs layer as we will be rendering over it
"scripts": {
"parent_setup": "v.leg_layer_visible = 0.0;"
},
// Same as before
"render_controllers": ["controller.render.armor"]
}
}
}
```
Given that we have already put in the textures needed we can run it and see our legs straight away.
## Helmet
This is just like the chest piece, just we change some of the categories and slots like so.
<CodeHeader>BP/items/my_helm.json</CodeHeader>
```json
{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "wiki:my_helm",
"category": "equipment"
},
"components": {
// Helmet category
"minecraft:creative_category": {
"parent": "itemGroup.name.helmet"
},
"minecraft:icon": {
"texture": "my_helm"
},
"minecraft:display_name": {
"value": "My Custom Helmet"
},
"minecraft:max_stack_size": 1,
// Helm enchantment slot
"minecraft:enchantable": {
"value": 10,
"slot": "armor_head"
},
"minecraft:armor": {
"protection": 3
},
"minecraft:repairable": {
"repair_items": [
{
"items": ["minecraft:stick"],
"repair_amount": "context.other->q.remaining_durability + 0.05 * context.other->q.max_durability"
}
]
},
// Wearable head slot
"minecraft:wearable": {
"dispensable": true,
"slot": "slot.armor.head"
},
"minecraft:durability": {
"max_durability": 200
}
}
}
}
```
As you can see not much has changed, we just update the categories/slots to the correct ones for helms and then we add the attachables file (here is the item texture if you need it).
![](/assets/images/tutorials/custom-armor/custom_helmet.png)
<BButton link="https://raw.githubusercontent.com/Bedrock-OSS/bedrock-wiki/wiki/docs/public/assets/images/tutorials/custom-armor/custom_helmet.png">Download texture here</BButton>
<CodeHeader>RP/attachables/my_helm.json</CodeHeader>
```json
{
"format_version": "1.8.0",
"minecraft:attachable": {
"description": {
"identifier": "wiki:my_helm",
// These 2 are default and are required
"materials": {
"default": "armor",
"enchanted": "armor_enchanted"
},
"textures": {
// This is our CUSTOM armor texture we need to make next
"default": "textures/models/armor/custom_main",
// This texture doesn't actually exist in our RP
// but it will blow up without it so leave it in
"enchanted": "textures/misc/enchanted_item_glint"
},
// We tell it what geometry to use for the helmet
"geometry": {
"default": "geometry.player.armor.helmet"
},
// We tell it to hide the helmet layer as we will be showing our armor on top
"scripts": {
"parent_setup": "v.chest_layer_visible = 0.0;"
},
// We tell it what controller to use (default armor one)
"render_controllers": ["controller.render.armor"]
}
}
}
```
There you go, you now have 3/4 of a complete set, we may as well go through the boots as well so you know all the categories etc.
## Boots
You already know the pattern so lets make the item and attachable json files.
<CodeHeader>BP/items/my_boots.json</CodeHeader>
```json
{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "wiki:my_boots",
"category": "equipment"
},
"components": {
// Boots category
"minecraft:creative_category": {
"parent": "itemGroup.name.boots"
},
"minecraft:icon": {
"texture": "my_boots"
},
"minecraft:display_name": {
"value": "My Custom Boots"
},
"minecraft:max_stack_size": 1,
// Enchantable Feet
"minecraft:enchantable": {
"value": 10,
"slot": "armor_feet"
},
"minecraft:armor": {
"protection": 3
},
"minecraft:repairable": {
"repair_items": [
{
"items": ["minecraft:stick"],
"repair_amount": "context.other->q.remaining_durability + 0.05 * context.other->q.max_durability"
}
]
},
// Feet slot
"minecraft:wearable": {
"dispensable": true,
"slot": "slot.armor.feet"
},
"minecraft:durability": {
"max_durability": 200
}
}
}
}
```
The custom boots texture if you need it.
![](/assets/images/tutorials/custom-armor/custom_boots.png)
<BButton link="https://raw.githubusercontent.com/Bedrock-OSS/bedrock-wiki/wiki/docs/public/assets/images/tutorials/custom-armor/custom_boots.png">Download texture here</BButton>
<CodeHeader>RP/attachables/my_boots.json</CodeHeader>
```json
{
"format_version": "1.8.0",
"minecraft:attachable": {
"description": {
"identifier": "wiki:my_boots",
// These 2 are default and are required
"materials": {
"default": "armor",
"enchanted": "armor_enchanted"
},
"textures": {
// This is our CUSTOM armor texture we need to make next
"default": "textures/models/armor/custom_main",
// This texture doesn't actually exist in our RP
// but it will blow up without it so leave it in
"enchanted": "textures/misc/enchanted_item_glint"
},
// We tell it what geometry to use for the boots
"geometry": {
"default": "geometry.player.armor.boots"
},
// We tell it to hide the boots layer as we will be showing our armor on top
"scripts": {
"parent_setup": "v.chest_layer_visible = 0.0;"
},
// We tell it what controller to use (default armor one)
"render_controllers": ["controller.render.armor"]
}
}
}
```
Thats it, you now have a whole suit of custom armor you can swagger around in, and use this as a basis to make whatever other armors you want in the game.
> It is worth noting that we have used 2 separate textures here, and you could potentially use a texture per attachable, but each new texture consumes memory so its best to use as few as possible.
> So this is what you should end up with, and as a bonus there is one more section on making set effects using filters, which is a bit more advanced but its a fun thing to do.
![](/assets/images/tutorials/custom-armor/custom-set-image.jpg)
## Bonus - Making Set Effects
This is a bit more advanced but lets say you want your custom armor to act like it's a set from an RPG game. We can add some code to check if we have the set equipped and do some great stuff with it.
Note that for effects you can use tick.json and functions with hasitem selector argument to avoid using player.json.
In this example we will just add a chance to teleport the attacker somewhere nearby and put a blurb on the console for flavour.
As we want this to trigger when the player is hit we need to add some logic to the `player.json` file. This is a huge file and we unfortunately need to make sure it has all the default content in there as well due to the way it will overwrite the default player components etc.
So rather than include the whole `player.json` I will just include the parts you will need to add to your `components` and `events` sections. If you have no idea what the `player.json` is then look in the vanilla behavior pack and look for it and just copy it over into your project.
So first of all lets put in the damage sensor component (which goes in your component section) which listens for when you take damage and lets you raise an event from it.
<CodeHeader>BP/entities/player.json#components</CodeHeader>
```json
"minecraft:damage_sensor": {
"triggers": {
"on_damage": {
"filters": {
"all_of": [
{
"test": "has_equipment",
"subject": "self",
// Domain is the body part in this case
"domain": "head",
"operator": "==",
// The item identifier we want to check
"value": "wiki:my_helm"
},
{
"test": "has_equipment",
"subject": "self",
"domain": "torso",
"operator": "==",
// Worth noting you can omit prefix for minecraft internal items i.e stick
"value": "wiki:my_chest"
},
{
"test": "has_equipment",
"subject": "self",
"domain": "leg",
"operator": "==",
"value": "wiki:my_leggings"
},
{
"test": "has_equipment",
"subject": "self",
"domain": "feet",
"operator": "==",
"value": "wiki:my_boots"
}
]
},
// If all the triggers match in the filter raise the event
"event": "wiki:armor_sets.my_custom.taken_damage"
},
// This means if it matches the check it still applies damage
// Can be good to ignore team damage or similar scenarios
"deals_damage": true
}
}
```
As you can see from the comments, there is a lot there but really all we are doing is listening out for something then making sure we only filter the results we care about then relay on an event.
> The event can be called anything but it is often better to have it more specific, incase you end up having multiple similar events etc, also it can help finding if you have multiple sections to it, i.e I could search on "armour_sets" and find all events related to it.
> Then once you are done, in the same file we decide what we want to do with the event, which we put into our `events` section.
<CodeHeader>BP/entities/player.json#events</CodeHeader>
```json
"wiki:armor_sets.my_custom.taken_damage": {
"randomize": [
{
"weight": 1,
// We do a sequence here as we want to apply one command
// on one entity and the other on ourselves
"sequence": [
{
// This will take the attacker/other because it was in context
// at time of raising the event in the damage_sensor
"run_command": {
// Teleport the entity away from us
"command": "spreadplayers ~~ 5 20 @s",
// Run the command on the attacker not us
"target": "other"
}
},
{
"run_command": {
"command": "tellraw @s{\"rawtext\":[{\"text\":\"§aYour Armor Glows And The Enemy Vanishes\"}]}"
}
}
]
},
{
// Dummy weighting so it happens semi frequently
"weight": 20
}
]
}
```
Thats it, you can rejig the bits how you see fit but ultimately you have all the pieces to apply effects to armor and check for if you have the whole set applied or check for other equipment.
You can also change the equipment checks from self to other and check if whoever is attacking you has something equipped or even check if you are attacking a sort of block/entity and do different effects based on that. We haven't touched on that directly here but there is a good enough starting point to get you on your way and let you be creative with things.

View File

@@ -0,0 +1,277 @@
---
title: Custom Weapons
category: Tutorials
tags:
- experimental
mentions:
- SirLich
- solvedDev
- MedicalJewel105
- aexer0e
- PepijnMC
- ThomasOrs
- Xterionix
---
Making a custom weapon is pretty simple since the 1.16.100 changes, as these allow you to simply define an item entry for it in your `BP/items` folder and provide a corresponding texture in the `RP/textures/items` folder with a bit of config and you have a fully working weapon that you can customize however you see fit.
## Custom Sword Item
Like with the other item tutorials we will start by making a simple custom sword like so.
<CodeHeader>BP/items/my_sword.json</CodeHeader>
```json
{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "wiki:my_sword",
// Notice we give it the equipment category
"category": "equipment"
},
"components": {
// This allows us to have the sword in the creative category of swords
"minecraft:creative_category": {
"parent": "itemGroup.name.sword"
},
"minecraft:max_stack_size": 1,
// This is a new change as we want it to be equippable in the hand
"minecraft:hand_equipped": true,
"minecraft:durability": {
"max_durability": 600
},
// Give it however much damage you want
"minecraft:damage": 10,
// We also let it be enchantable in the "sword" slot
"minecraft:enchantable": {
"value": 10,
"slot": "sword"
},
// This texture is used for both inventory and the hand model
"minecraft:icon": {
"texture": "my_sword"
},
"minecraft:display_name": {
"value": "My Custom Sword"
},
// Allow the sword to be repaired with sticks
"minecraft:repairable": {
"repair_items": [
{
"items": ["minecraft:stick"],
"repair_amount": "context.other->q.remaining_durability + 0.05 * context.other->q.max_durability"
}
]
}
}
}
}
```
So at a bare minimum that is enough to get a sword put into the game, we still need to register the icon with the RP but thats not a massive issue as all we need to do is go to our RP folder and enter it in like so.
<CodeHeader>RP/textures/item_texture.json</CodeHeader>
```json
{
"resource_pack_name": "vanilla",
"texture_name": "atlas.items",
"texture_data": {
"my_sword": {
// Make sure you have put an icon texture called my_sword.png here
"textures": "textures/items/my_sword"
}
}
}
```
Here is an example texture if you do not have your own to use, just `Save As` and plop it in the `RP/textures/items` directory.
![](/assets/images/tutorials/custom-weapons/my_sword.png)
<BButton link="https://raw.githubusercontent.com/Bedrock-OSS/bedrock-wiki/wiki/docs/public/assets/images/tutorials/custom-weapons/my_sword.png">Download texture here</BButton>
## In-game
So now we have a BP containing our items json data and an RP containing the texture, we can make a new level, and make sure we include our BP/RP, however we **also need to enable the Holiday Creator Features** under experimental gameplay.
Once you have done all the above, go into creative mode and you should be able to find your sword by its name, or under the sword category as shown.
![](/assets/images/tutorials/custom-weapons/custom_sword.jpg)
Then if you put it in your hands you should see it in the game like this.
![](/assets/images/tutorials/custom-weapons/held_sword.jpg)
Now that wasn't too hard was it! and you can make as many custom swords as you want now, however there is far more fun stuff you can do from here if you feel up for it.
## Tool-like Functionality
You can also mix and match other components like `minecraft:digger` to allow you to go through web or bamboo quicker like this:
<CodeHeader>BP/items/my_sword.json#components</CodeHeader>
```json
"minecraft:digger": {
"use_efficiency": true,
"destroy_speeds": [
{
"block": "minecraft:web",
"speed": 15
},
{
"block": "minecraft:bamboo",
"speed": 10
}
],
"on_dig":{
"event": "wiki:my_sword.on_dig_damage"
//Needed to change sword durability
}
}
```
Also add an event:
<CodeHeader>BP/items/my_sword.json</CodeHeader>
```json
"events": {
"wiki:my_sword.on_dig_damage": {
"damage":{
//This part of event will make sword take damage when it was used to dig block
"type":"durability",
"target":"self",
//By using "self" you define item as target to take damage
"amount":1
}
}
}
```
You can also give it a default mining speed by adding `"minecraft:mining_speed": 1.5`, which would give it a generic mining speed letting you use your weapon like a pickaxe.
(It is currently broken)
## Damage Tooltip
The above was a bare bones approach, but you probably want to be able to show the damage a sword does when the user hovers over it.
To do this you need to add the `"minecraft:weapon": {}` component, even if its just empty this is enough to MC to know internally to treat your popup like a weapon popup when mouse over-ing.
So if you add the above component to your item json file when you mouse over your sword you will now see **+10 Attack Damage** listed in its tooltip.
> You may be thinking "why didn't you just add this above?" and the answer is because we will build off this component to add more cool stuff in the next section, so I wanted to keep it separate.
## Unique ability & durability
At this point you could call it a day, but what if you wanted to make a sword that could inflict status effects, or teleport an enemy when they attacked you?
Assuming you wanted to do something like this we will need to build off the `minecraft:weapon` component and raise an event when the weapon hits an entity.
<CodeHeader>BP/items/my_sword.json#components</CodeHeader>
```json
"minecraft:weapon": {
"on_hurt_entity": {
"event": "wiki:my_sword.hurt_entity"
}
}
```
Once we add that then every time you hurt an entity it will raise the event `wiki:my_sword.hurt_entity`. You can name this whatever you want, but if you end up with lots of events its recommended to have some level of namespacing, so in this scenario `example` is my main namespace, `my_sword` is the item I want it to apply on and `hurt_entity` is the related event on that item.
> I could just as easily call the event **"space-noodle"** and it would work fine, but you want it to be easily searchable and self explaining, so keep that in mind
Now that we have an event being raised we can do what we want with it. In this example I am going to do 3 things:
1. Teleport the player with 25% chance.
2. Output a message letting the player know that something happened.
3. Damage the sword.
So if you go back into your my_sword.json and after your `components` section add a new section like so.
<CodeHeader>BP/items/my_sword.json</CodeHeader>
```json
"events": {
"wiki:my_sword.hurt_entity": {
"sequence":[
//Sequence is needed to run two or more parts of event
{
"randomize": [
{
// Weights are relative, so this has 1
"weight": 1,
// Teleport the HOLDER (you) within an 8x8x8 range
"teleport": {
"target": "holder",
"max_range": [8,8,8]
},
// Then tell some green text
"run_command":{
"command":[
"tellraw @s{\"rawtext\":[{\"text\":\"§aYour Sword Glows§r\"}]}"
]
}
},
{
// We have another dummy random element here which contains the max weight
"weight": 3
}
]
},
{
// I think you haven't forgot what this do
"damage":{
"type":"durability",
"target":"self",
"amount":1
}
}
]
}
}
```
That was a bit to bite off, but as explained above this lets us randomly **1/4** of the time trigger a teleportation of the sword holder and show a text command when it happens.
You can do whatever you want here and get super creative, set enemies on fire, or spawn enemies or blocks etc. There is so much you can do with this basic approach to creating weapons!
> It's worth noting here that the dummy element is needed to scale the weightings, so we have one element with a weight of **1** and a 2nd one with a weight of **4** so this gives us the **1 in 4** chance of it proccing. If we were to have gone with the dummy element having a weight of **100** then we would have a **1 in 100** chance of proccing. If we didn't have a 2nd dummy element then the first weight would be ignored and it would happen 100% of the time.
## Anything Else?
You should probably make a recipe for it, which is covered in previous chapters, as there isn't anything really new in there, but incase you are unsure here is an example one to make the sword with ender eyes and ender pearls.
<CodeHeader>BP/recipes/my_sword.json</CodeHeader>
```json
{
"format_version": "1.12.0",
"minecraft:recipe_shaped": {
"description": {
"identifier": "wiki:my_sword"
},
"tags": ["crafting_table"],
"pattern": ["e", "E", "#"],
"key": {
"#": {
"item": "minecraft:stick"
},
"E": {
"item": "minecraft:ender_eye"
},
"e": {
"item": "minecraft:ender_pearl"
}
},
"result": {
"item": "wiki:my_sword"
}
}
}
```
![](/assets/images/tutorials/custom-weapons/sword_recipe.jpg)
If you whack that in then you can now craft your sword in the game and hopefully go off and make any other custom swords you fancy or even bows or tridents.

View File

@@ -0,0 +1,54 @@
---
title: Enchantments
category: Documentation
nav_order: 5
tags:
- Stable
- Last updated for Version 1.18.10
mentions:
- Ciosciaa
- MedicalJewel105
- SmokeyStack
---
Enchantment identifiers are used in the `/enchant` command and in item functions and conditions.
| Name | Identifier | Maximum Level | Treasure | Curse |
| ----------------------- | ----------------------- | ------------- | -------- | ----- |
| Silk Touch | `silk_touch` | 1 | ❌ | ❌ |
| Fortune | `fortune` | 3 | ❌ | ❌ |
| Efficiency | `efficiency` | 5 | ❌ | ❌ |
| Luck of the Sea | `luck_of_the_sea` | 3 | ❌ | ❌ |
| Lure | `lure` | 3 | ❌ | ❌ |
| Sharpness | `sharpness` | 5 | ❌ | ❌ |
| Smite | `smite` | 5 | ❌ | ❌ |
| Bane of Arthropods | `bane_of_arthropods` | 5 | ❌ | ❌ |
| Fire Aspect | `fire_aspect` | 2 | ❌ | ❌ |
| Knockback | `knockback` | 2 | ❌ | ❌ |
| Looting | `looting` | 3 | ❌ | ❌ |
| Power | `power` | 5 | ❌ | ❌ |
| Flame | `flame` | 1 | ❌ | ❌ |
| Punch | `punch` | 2 | ❌ | ❌ |
| Infinity | `infinity` | 1 | ❌ | ❌ |
| Multishot | `multishot` | 1 | ❌ | ❌ |
| Piercing | `piercing` | 4 | ❌ | ❌ |
| Quick Charge | `quick_charge` | 3 | ❌ | ❌ |
| Impaling | `impaling` | 5 | ❌ | ❌ |
| Riptide | `riptide` | 3 | ❌ | ❌ |
| Loyalty | `loyalty` | 3 | ❌ | ❌ |
| Channeling | `channeling` | 1 | ❌ | ❌ |
| Protection | `protection` | 4 | ❌ | ❌ |
| Projectile Protection | `projectile_protection` | 4 | ❌ | ❌ |
| Fire Protection | `fire_protection` | 4 | ❌ | ❌ |
| Blast Protection | `blast_protection` | 4 | ❌ | ❌ |
| Feather Falling | `feather_falling` | 4 | ❌ | ❌ |
| Thorns | `thorns` | 3 | ❌ | ❌ |
| Frost Walker | `frost_walker` | 2 | ✅ | ❌ |
| Respiration | `respiration` | 3 | ❌ | ❌ |
| Aqua Affinity | `aqua_affinity` | 1 | ❌ | ❌ |
| Curse of Binding | `curse_of_binding` | 1 | ✅ | ✅ |
| Depth Strider | `depth_strider` | 3 | ❌ | ❌ |
| Soul Speed | `soul_speed` | 3 | ✅ | ❌ |
| Unbreaking | `unbreaking` | 3 | ❌ | ❌ |
| Mending | `mending` | 1 | ✅ | ❌ |
| Curse of Vanishing | `curse_of_vanishing` | 1 | ✅ | ✅ |

View File

@@ -0,0 +1,260 @@
---
title: Run Commands with Equipped Items
category: Tutorials
tags:
- experimental
- intermediate
mentions:
- Chikorita-Lover
- MedicalJewel105
- Luthorius
- TheItsNameless
---
## Introduction
A common concept for add-ons is implementing new armor sets with unique effects, just like the turtle shell and netherite armor. While items have a knockback resistance component, they don't have a component for inflicting mob effects, emitting particles, etc. under certain conditions. However, using server animations, Molang and item tags, this can easily be done!
Keep in mind that this requires modifying the player behavior, which is a common theme for many add-ons; thus, your add-on may not be compatible with others if you wish to do this.
> However some people found a way not to use player.json. They replace it with dummy entity-rider. Try experimenting yourself!
The use of Holiday Creator Features is also required to add item tags and easily equip our item in armor or off-hand slots.
## Server Animation
The first step will be to create a server animation, which is a file that runs commands or events at certain keyframes. While client animations are in the resource pack, server animations are in the behavior pack. You can read a bit more [here](/entities/timers#animation-based-timers). We can start by using the following as a template:
<CodeHeader>BP/animations/player.json</CodeHeader>
```json
{
"format_version": "1.10.0",
"animations": {
"animation.player.emerald_armor": {
"timeline": {
"0.0": []
},
"animation_length": 0.05,
"loop": true
}
}
}
```
Let's go over what's in this template and what everything does:
- `animation.player.emerald_armor` is our animation's identifier; you can change this to something else, such as `animation.player.phantom_armor`.
- `timeline` runs commands and events at given keyframes.
- `animation_length` is how long the animation lasts; we'll use 0.05 seconds, as that's the length of an in-game tick.
- `loop` is quite straight-forward; setting it to true makes the animation loop.
We can add commands to the `0.0` array in our timeline to execute, such as an `/effect` command, like such:
<CodeHeader>BP/animations/player.json#timeline</CodeHeader>
```json
{
"0.0": [
"/effect @s speed 1 0"
]
}
```
We're not limited to `/effect`, of course. If you want to use some other command, such as `/function` or `/particle`, go right ahead!
After this, we're finished in our server animation, and we'll head into the behavior file for our item for a quick addition.
## Item Behavior
To actually check if our item is equipped, we can use a Molang query that checks for item tags.
You can skip this section if:
- You want check for a vanilla item instead, such as an iron armor piece through the `minecraft:iron_tier` tag
- You want to check for the item via `q.is_item_name_any`, which checks for an item identifier in any slot
In our item's behavior, we'll have to add a tag to `components`. For example, if we wanted to add the `example:emerald_tier` tag, we would add the `tag:example:emerald_tier` component:
<CodeHeader>BP/items/my_item.json#components</CodeHeader>
```json
"tag:example:emerald_tier": {}
```
That's it, now your item has whatever tag you assigned it! You can add more tags if you want, but this is all we need for what we're doing.
## Player Behavior
Finally, we need to modify the player's behavior to run the server animation. We'll be working entirely within `description`.
First, we need to set a short name for our animation. If you have any experience with client animations, this process will be quite similar. Add `animations` to `description`, and set a short name, like such:
<CodeHeader>BP/entities/player.json#description</CodeHeader>
```json
{
"identifier": "minecraft:player",
"is_spawnable": false,
"is_summonable": false,
"is_experimental": false,
"animations": {
"emerald_armor": "animation.player.emerald_armor"
}
}
```
Now with a short name set, we can run our animation.
Add `scripts` to `description`, and set a Molang query to run. To check for the item, we can use one of the following:
- `q.is_item_name_any`, to check for a given item identifier in any slot. This example will check for `example:totem_of_retreat` in either hand:
```
q.is_item_name_any('slot.weapon.mainhand',0,'example:totem_of_retreat') || q.is_item_name_any('slot.weapon.offhand',0,'example:totem_of_retreat')
```
- `q.equipped_item_any_tag`, to check for at least one of any given tag in a given slot. This example will allow an emerald- or phantom- tier armor piece to be used:
```
q.equipped_item_any_tag('slot.armor.head','example:emerald_tier','example:phantom_tier')
```
- `q.equipped_item_all_tags`, to check for all given tags in a given slot. This example will only allow an armor piece that's both emerald- and ancient- tier:
```
q.equipped_item_all_tags('slot.armor.head','example:ancient_tier','example:emerald_tier')
```
Let's take a look at an example using `q.equipped_item_any_tag`:
<CodeHeader>BP/entities/player.json#description</CodeHeader>
```json
{
"identifier": "minecraft:player",
"is_spawnable": false,
"is_summonable": false,
"is_experimental": false,
"animations": {
"emerald_armor": "animation.player.emerald_armor"
},
"scripts": {
"animate": [
{
"emerald_armor": "q.equipped_item_any_tag('slot.armor.head','example:emerald_tier')"
}
]
}
}
```
This example will run a server animation with the `emerald_armor` short name if an emerald-tier item is equipped in the helmet slot. You can change the Molang field to match your item tag, use a different query, or add additional queries.
You can view a list of additional slot identifiers at the [Minecraft Wiki](https://minecraft.wiki/w/Slot#Bedrock_Edition).
## Conclusion
With the server animation, player behavior, and item tag all set up, your equipped item can now run commands! This technique allows for greater item customization than being restricted to item components. If you want to add more to the effect or add-on, check the next section; otherwise, congratulations, you're finished!
## Additions
### Multiple Required Items
If you want to run a command when multiple of the armor set's pieces are equipped, we can expand our Molang from before:
<CodeHeader>BP/entities/player.json#scripts</CodeHeader>
```json
"animate": [
{
"emerald_armor": "q.equipped_item_any_tag('slot.armor.head','example:emerald_tier') && q.equipped_item_any_tag('slot.armor.chest','example:emerald_tier') && q.equipped_item_any_tag('slot.armor.legs','example:emerald_tier') && q.equipped_item_any_tag('slot.armor.feet','example:emerald_tier')"
}
]
```
This example will check for emerald-tier armor in all four armor slots, and run the animation if they're all equipped.
### Further Conditions
The turtle shell doesn't always inflict Water Breathing, but instead only for 10 seconds when a player first enters water. If we want our emerald armor to only run our animation when we have lower health, we can add another query to our Molang:
<CodeHeader>BP/entities/player.json#scripts</CodeHeader>
```json
"animate": [
{
"emerald_armor": "q.equipped_item_any_tag('slot.armor.head','example:emerald_tier') && q.health <= 5"
}
]
```
This example will run the animation with 2.5 hearts or less remaining, allowing players to make a quick getaway when they're in danger.
We can also apply this to requiring multiple armor pieces, with even longer Molang:
<CodeHeader>BP/entities/player.json#scripts</CodeHeader>
```json
{
"animate": [
{
"emerald_armor": "q.equipped_item_any_tag('slot.armor.head','example:emerald_tier') && q.equipped_item_any_tag('slot.armor.chest','example:emerald_tier') && q.equipped_item_any_tag('slot.armor.legs','example:emerald_tier') && q.equipped_item_any_tag('slot.armor.feet','example:emerald_tier') && q.health <= 5"
}
]
}
```
You can view a list of documented Molang queries at [bedrock.dev](https://bedrock.dev/docs/stable/Molang#List%20of%20Entity%20Queries).
### Multiple Items with Effects
If you want to add more items with unique effects, fret not; this is easily done. You can either create a new server animation file, or add on to the file from before, like such:
<CodeHeader>BP/animations/player.json</CodeHeader>
```json
{
"format_version": "1.10.0",
"animations": {
"animation.player.emerald_armor": {
"timeline": {
"0.0": ["..."]
},
"animation_length": 0.05,
"loop": true
},
"animation.player.phantom_armor": {
"timeline": {
"0.0": ["..."]
},
"animation_length": 0.05,
"loop": true
}
}
}
```
In our player behavior, you'll have to add on to `animations` and `scripts` as well.
<CodeHeader>BP/entities/player.json#description</CodeHeader>
```json
{
"identifier": "minecraft:player",
"is_spawnable": false,
"is_summonable": false,
"is_experimental": false,
"animations": {
"emerald_armor": "animation.player.emerald_armor",
"phantom_armor": "animation.player.phantom_armor"
},
"scripts": {
"animate": [
{
"emerald_armor": "q.equipped_item_any_tag('slot.armor.head','example:emerald_tier')"
},
{
"phantom_armor": "q.equipped_item_any_tag('slot.armor.head','example:phantom_tier')"
}
]
}
}
```

10
docs/wiki/items/index.md Normal file
View File

@@ -0,0 +1,10 @@
---
title: Items
categories:
- title: General
color: blue
- title: Tutorials
color: green
- title: Documentation
color: red
---

View File

@@ -0,0 +1,510 @@
---
title: Item Components
description: Item components are used to change how your item appears and functions in the world.
category: General
nav_order: 2
mentions:
- SmokeyStack
- QuazChick
---
:::tip FORMAT & MIN ENGINE VERSION `1.20.50`
Using the latest format version when creating custom items provides access to fresh features and improvements. The wiki aims to share up-to-date information about custom items, and currently targets format version `1.20.50`.
:::
## Applying Components
Item components are used to change how your item appears and functions in the world. They are applied in the `components` child of `minecraft:item`.
<CodeHeader>BP/items/custom_item.json</CodeHeader>
```json
{
"format_version": "1.20.50",
"minecraft:item": {
"description": {
"identifier": "wiki:custom_item",
"menu_category": {
"category": "items"
}
},
"components": {
"minecraft:icon": {
"texture": "custom_item"
}
}
}
}
```
## Allow Off Hand
Determines whether an item can be placed in the off-hand slot of the inventory.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:allow_off_hand": {
"value": true
}
```
## Block Placer
Sets the item as a Planter item component for blocks. Items with this component will place a block when used.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:block_placer":{
"block": "seeds",
"use_on": [
"dirt",
"grass"
]
}
```
## Can Destroy In Creative
Determines if an item will break blocks in Creative Mode while swinging.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:can_destroy_in_creative": {
"value": true
}
```
## Cooldown
Sets an items "Cool down" time. After using an item, it becomes unusable for the duration specified by the 'duration' setting of this component.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:cooldown":{
"category" : "attack",
"duration" : 0.2
}
```
## Damage
Determines how much extra damage an item does on attack.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:damage": {
"value": 10
}
```
## Digger
Allows a creator to determine how quickly an item can dig specific blocks.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:digger": {
"use_efficiency": true,
"destroy_speeds": [
{
"block": {
"tags": "q.any_tag('stone', 'metal')" // Note that not all blocks have tags; listing many blocks may be necessary
},
"speed": 6
}
]
}
```
## Display Name
Sets the item display name within Minecraft: Bedrock Edition. This component may also be used to pull from the localization file by referencing a key from it.
### Example
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:display_name":{
"value": "secret_weapon"
}
```
### Example Using Localization Key
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:display_name":{
"value": "item.snowball.name"
}
```
## Durability
Sets how much damage the item can take before breaking, and allows the item to be combined at an anvil, grindstone, or crafting table.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:durability":{
"damage_chance": {
"min": 10,
"max": 50
},
"max_durability": 36
}
```
## Enchantable
Determines what enchantments can be applied to the item. Not all enchantments will have an effect on all item components.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:enchantable": {
"slot": "bow",
"value": 10
}
```
### Enchantable Slots
Note: The "all" enchantable slot allows you to apply any enchantment that you want to the item, just like an enchanted book.
| Slot Name |
| ------------- |
| armor_feet |
| armor_torso |
| armor_head |
| armor_legs |
| axe |
| bow |
| cosmetic_head |
| crossbow |
| elytra |
| fishing_rod |
| flintsteel |
| hoe |
| pickaxe |
| shears |
| shield |
| shovel |
| sword |
| all |
## Entity Placer
Allows an item to place entities into the world. Additionally, in version 1.19.80 and above, the component allows the item to set the spawn type of a monster spawner.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:entity_placer":{
"entity": "minecraft:spider",
"dispense_on": ["minecraft:web"],
"use_on": ["minecraft:web"]
}
```
## Food
Sets the item as a food component, allowing it to be edible to the player.
:::tip
The `minecraft:food` must have the `minecraft:use_modifiers` component in order to function properly.
:::
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:food":{
"can_always_eat": false,
"nutrition" : 3,
"effects" : [
{
"name": "poison",
"chance": 1.0,
"duration": 5,
"amplifier": 0
}
],
"saturation_modifier": "normal",
"using_converts_to": "bowl"
}
```
## Fuel
Allows this item to be used as fuel in a furnace to 'cook' other items.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:fuel":{
"duration": 3.0
}
```
## Glint
Determines whether the item has the enchanted glint render effect on it.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:glint": false
```
## Hand Equipped
Determines if an item is rendered like a tool while in-hand.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:hand_equipped": {
"value": true
}
```
## Hover Text Color
Determines the color of the item name when hovering over it.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:hover_text_color": "green"
```
## Icon
Sets the icon item component. Determines the icon to represent the item in the UI and elsewhere.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:icon":{
"texture": "oak_slab"
}
```
## Interact Button
Is a boolean or string that determines if the interact button is shown in touch controls, and what text is displayed on the button. When set to 'true', the default 'Use Item' text will be used.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:interact_button": "Use This Custom Item" // Can be a string or a boolean value.
```
## Liquid Clipped
Determines whether an item interacts with liquid blocks on use.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:liquid_clipped": {
"value": true
}
```
## Max Stack Size
Determines how many of an item can be stacked together.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:max_stack_size": {
"value": 64
}
```
## Projectile
Compels the item to shoot, similarly to an arrow. Items with `minecraft:projectile` can be shot from dispensers or used as ammunition for items with the `minecraft:shooter` item component. Additionally, this component sets the entity that is spawned for items that also contain the `minecraft:throwable` component.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:projectile":{
"minimum_critical_power": 1.25,
"projectile_entity": "arrow"
}
```
## Record
Used by record items to play music.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:record": {
"comparator_signal": 1,
"duration": 5,
"sound_event": "ambient.tame"
}
```
### Sound Event
Listed [here](https://learn.microsoft.com/en-us/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_record?view=minecraft-bedrock-stable) are the available sounds
## Repairable
Defines the items that can be used to repair a defined item, and the amount of durability each item restores upon repair. Each entry needs to define a list of strings for 'items' that can be used for the repair and an optional 'repair_amount' for how much durability is repaired.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:repairable":{
"on_repaired": "minecraft:celebrate",
"repair_items": ["anvil"]
}
```
## Shooter
Compels an item to shoot projectiles, similarly to a bow or crossbow. Must have the `minecraft:use_modifiers` component in order to function properly.
:::tip
Ammunition used by `minecraft:shooter` must have the `minecraft:projectile` component in order to function properly.
:::
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"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
}
```
## Should Despawn
Determines if an item should despawn while floating in the world.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:should_despawn": {
"value": true
}
```
## Stacked By Data
Determines if the same item with different aux values can stack. Additionally, this component defines whether the item actors can merge while floating in the world.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:stacked_by_data": {
"value": true
}
```
## Tags
Determines which tags are included on a given item.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:tags": {
"tags": [
"custom_tag"
]
}
```
## Throwable
Sets the throwable item component.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"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
}
```
## Use Animation
Determines which animation plays when using an item.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:use_animation": "eat"
```
## Use Modifiers
Determines how long an item takes to use in combination with components such as Shooter, Throwable, or Food.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:use_modifiers": {
"use_duration": 1.6,
"movement_modifier": 0.35
}
```
## Wearable
Sets the wearable item component.
<CodeHeader>minecraft:item > components</CodeHeader>
```json
"minecraft:wearable":{
"dispensable" : true,
"slot": "slot.chest"
}
```
### Slots
| Slot Name |
| -------------------- |
| slot.weapon.mainhand |
| slot.weapon.offhand |
| slot.armor.head |
| slot.armor.chest |
| slot.armor.legs |
| slot.armor.feet |
| slot.hotbar |
| slot.inventory |
| slot.enderchest |
| slot.saddle |
| slot.armor |
| slot.chest |
| slot.equippable |

View File

@@ -0,0 +1,138 @@
---
title: Vanilla Item Identifiers
category: Documentation
tags:
- deprecated
mentions:
- TheDoctor15
- Medicaljewel105
- Luthorius
- epxzzy
- SmokeyStack
---
:::danger
This method no longer works after 1.18.30.
:::
An `identifier` is a required parameter that sits inside the description of the item's behaviour file.
It accepts Vanilla Minecraft names, like so, `<namespace>:<vanilla item>`, which will apply certain hardcoded item behaviours, depending on the identifier used.
<CodeHeader>BP/items/custom_item.json#minecraft:item</CodeHeader>
```json
"description": {
"identifier": "wiki:totem_of_undying",
"category": "items"
}
```
:::warning
Not every Vanilla Identifier and their behaviours are documented. The following list may be missing important points about the known Identifiers that do affect items.
Consider experimenting with them.
:::
## Known Identifier Effects
The namespace is allowed to be changed, learn more about namespaces [here](/concepts/namespaces).
### namespace:banner
- The item icon and model will be changed to that of the Vanilla Banner.
---
### namespace:bow
- Adds a small increasing zoom on use, for the zoom to work it requires the item to be usable.
---
### namespace:crossbow
- The item will be rotated horizontally on your arm.
---
### namespace:diamond
- Is accepted as a valid item to change the effect given off by a Beacon.
---
### namespace:emerald
- Is accepted as a valid item to change the effect given off by a Beacon.
---
### namespace:filled_map
- Will add the holding map animation.
- Can be put in a cartography table.
---
### namespace:gold_ingot
- Is accepted as a valid item to change the effect given off by a Beacon.
---
### namespace:iron_ingot
- Is accepted as a valid item to change the effect given off by a Beacon.
---
### namespace:lapis_lazuli
- Makes the Item usable with Enchantment Tables, to enchant your items in place of Lapis Lazuli.
---
### namespace:lead
- Will behave like a Lead.
---
### namespace:map
- Will use the holding map animation.
---
### namespace:netherite_ingot
- Is accepted in custom Smithing Recipes as the secondary item.
- Is accepted as a valid item to change the effect given off by a Beacon.
---
### namespace:shield
- The item icon will be permanently changed to that of the Vanilla Shield.
- Adds the shield animation and behavior.
---
### namespace:spyglass
- Makes it zoom-able like a spyglass, for the zoom to work it requires the item to be usable.
---
### namespace:skull
- The item icon will be changed to that of the Vanilla Skull.
- The item will be able to put on a armorstand and a player, the model and textures of the skull will be applied only then.
---
### namespace:totem_of_undying
- Will behave like a Totem of Undying.
---

View File

@@ -0,0 +1,125 @@
---
title: Item Tags
category: General
nav_order: 3
mentions:
- Xterionix
- SmokeyStack
---
Item tags can be used to ensure that a item meets certain conditions.
## Applying Tags
### From 1.20.50 and onwards
<CodeHeader></CodeHeader>
```json
{
"format_version": "1.20.50",
"minecraft:item": {
"description": {
"identifier": "example:my_item"
},
"components": {
"minecraft:tags": {
"tags": [
"example:my_tag"
]
}
}
}
}
```
### Before 1.20.50
<CodeHeader></CodeHeader>
```json
{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "example:my_item"
},
"components": {
"tag:example:my_tag": {}
}
}
}
```
## Testing for Tags
Tags can be queried with:
- `q.all_tags`
- `q.any_tag`
- `q.equipped_item_all_tags`
- `q.equipped_item_any_tag`
## Lists of Vanilla Item Tags
Vanilla tags can be applied to custom items, and some vanilla items are tagged internally.
| Tag | Items |
|------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| minecraft:arrow | minecraft:arrow |
| minecraft:banner | minecraft:banner |
| minecraft:boat | minecraft:birch_boat, minecraft:bamboo_raft, minecraft:cherry_chest_boat, minecraft:mangrove_boat, minecraft:bamboo_chest_raft, minecraft:jungle_chest_boat, minecraft:oak_boat, minecraft:oak_chest_boat, minecraft:dark_oak_chest_boat, minecraft:cherry_boat, minecraft:mangrove_chest_boat, minecraft:acacia_boat, minecraft:acacia_chest_boat, minecraft:jungle_boat, minecraft:spruce_chest_boat, minecraft:dark_oak_boat, minecraft:boat, minecraft:spruce_boat, minecraft:birch_chest_boat, minecraft:chest_boat |
| minecraft:boats | minecraft:birch_boat, minecraft:bamboo_raft, minecraft:cherry_chest_boat, minecraft:mangrove_boat, minecraft:bamboo_chest_raft, minecraft:jungle_chest_boat, minecraft:oak_boat, minecraft:oak_chest_boat, minecraft:dark_oak_chest_boat, minecraft:cherry_boat, minecraft:mangrove_chest_boat, minecraft:acacia_boat, minecraft:acacia_chest_boat, minecraft:jungle_boat, minecraft:spruce_chest_boat, minecraft:dark_oak_boat, minecraft:boat, minecraft:spruce_boat, minecraft:birch_chest_boat, minecraft:chest_boat |
| minecraft:bookshelf_books | minecraft:writable_book, minecraft:book, minecraft:enchanted_book |
| minecraft:chainmail_tier | minecraft:chainmail_leggings, minecraft:chainmail_helmet, minecraft:chainmail_chestplate, minecraft:chainmail_boots |
| minecraft:coals | minecraft:coal, minecraft:charcoal |
| minecraft:crimson_stems | minecraft:stripped_crimson_stem, minecraft:stripped_crimson_hyphae, minecraft:crimson_stem, minecraft:crimson_hyphae |
| minecraft:decorated_pot_sherds | minecraft:friend_pottery_sherd, minecraft:archer_pottery_sherd, minecraft:burn_pottery_sherd, minecraft:heart_pottery_sherd, minecraft:arms_up_pottery_sherd, minecraft:brick, minecraft:danger_pottery_sherd, minecraft:heartbreak_pottery_sherd, minecraft:shelter_pottery_sherd, minecraft:explorer_pottery_sherd, minecraft:prize_pottery_sherd, minecraft:skull_pottery_sherd, minecraft:sheaf_pottery_sherd, minecraft:angler_pottery_sherd, minecraft:blade_pottery_sherd, minecraft:brewer_pottery_sherd, minecraft:howl_pottery_sherd, minecraft:miner_pottery_sherd, minecraft:mourner_pottery_sherd, minecraft:plenty_pottery_sherd, minecraft:snort_pottery_sherd |
| minecraft:diamond_tier | minecraft:diamond_chestplate, minecraft:diamond_boots, minecraft:diamond_helmet, minecraft:diamond_pickaxe, minecraft:diamond_leggings, minecraft:diamond_sword, minecraft:diamond_axe, minecraft:diamond_shovel, minecraft:diamond_hoe |
| minecraft:digger | minecraft:wooden_pickaxe, minecraft:golden_pickaxe, minecraft:netherite_hoe, minecraft:wooden_shovel, minecraft:wooden_hoe, minecraft:golden_axe, minecraft:iron_axe, minecraft:netherite_pickaxe, minecraft:iron_hoe, minecraft:wooden_axe, minecraft:stone_hoe, minecraft:stone_shovel, minecraft:stone_axe, minecraft:diamond_pickaxe, minecraft:netherite_axe, minecraft:diamond_axe, minecraft:stone_pickaxe, minecraft:iron_pickaxe, minecraft:iron_shovel, minecraft:golden_shovel, minecraft:diamond_shovel, minecraft:netherite_shovel, minecraft:golden_hoe, minecraft:diamond_hoe |
| minecraft:door | minecraft:wooden_door, minecraft:iron_door, minecraft:warped_door, minecraft:dark_oak_door, minecraft:crimson_door, minecraft:acacia_door, minecraft:jungle_door, minecraft:spruce_door, minecraft:birch_door, minecraft:mangrove_door, minecraft:cherry_door, minecraft:bamboo_door |
| minecraft:golden_tier | minecraft:golden_pickaxe, minecraft:golden_axe, minecraft:golden_chestplate, minecraft:golden_leggings, minecraft:golden_sword, minecraft:golden_helmet, minecraft:golden_boots, minecraft:golden_shovel, minecraft:golden_hoe |
| minecraft:hanging_actor | minecraft:painting |
| minecraft:hanging_sign | minecraft:warped_hanging_sign, minecraft:crimson_hanging_sign, minecraft:acacia_hanging_sign, minecraft:bamboo_hanging_sign, minecraft:dark_oak_hanging_sign, minecraft:jungle_hanging_sign, minecraft:cherry_hanging_sign, minecraft:oak_hanging_sign, minecraft:birch_hanging_sign, minecraft:mangrove_hanging_sign, minecraft:spruce_hanging_sign |
| minecraft:horse_armor | minecraft:diamond_horse_armor, minecraft:iron_horse_armor, minecraft:leather_horse_armor, minecraft:golden_horse_armor |
| minecraft:iron_tier | minecraft:iron_boots, minecraft:iron_axe, minecraft:iron_hoe, minecraft:iron_leggings, minecraft:iron_chestplate, minecraft:iron_sword, minecraft:iron_helmet, minecraft:iron_pickaxe, minecraft:iron_shovel |
| minecraft:is_armor | minecraft:iron_boots, minecraft:turtle_helmet, minecraft:chainmail_leggings, minecraft:diamond_chestplate, minecraft:diamond_boots, minecraft:leather_boots, minecraft:golden_chestplate, minecraft:netherite_helmet, minecraft:golden_leggings, minecraft:iron_leggings, minecraft:diamond_helmet, minecraft:iron_chestplate, minecraft:chainmail_helmet, minecraft:leather_helmet, minecraft:chainmail_chestplate, minecraft:elytra, minecraft:netherite_chestplate, minecraft:netherite_leggings, minecraft:netherite_boots, minecraft:leather_leggings, minecraft:chainmail_boots, minecraft:iron_helmet, minecraft:golden_helmet, minecraft:leather_chestplate, minecraft:diamond_leggings, minecraft:golden_boots |
| minecraft:is_axe | minecraft:golden_axe, minecraft:iron_axe, minecraft:wooden_axe, minecraft:stone_axe minecraft:netherite_axe, minecraft:diamond_axe |
| minecraft:is_cooked | minecraft:cooked_porkchop, minecraft:rabbit_stew, minecraft:cooked_salmon, minecraft:cooked_cod, minecraft:cooked_chicken, minecraft:cooked_beef, minecraft:cooked_mutton, minecraft:cooked_rabbit |
| minecraft:is_fish | minecraft:salmon, minecraft:cooked_salmon, minecraft:pufferfish, minecraft:cooked_cod, minecraft:tropical_fish, minecraft:cod |
| minecraft:is_food | minecraft:cookie, minecraft:sweet_berries, minecraft:cooked_porkchop, minecraft:carrot, minecraft:enchanted_golden_apple, minecraft:golden_carrot, minecraft:golden_apple, minecraft:beetroot_soup, minecraft:rabbit_stew, minecraft:chicken, minecraft:porkchop, minecraft:beef, minecraft:bread, minecraft:beetroot, minecraft:potato, minecraft:dried_kelp, minecraft:cooked_chicken, minecraft:apple, minecraft:melon_slice, minecraft:mutton, minecraft:rabbit, minecraft:rotten_flesh, minecraft:cooked_beef, minecraft:cooked_mutton, minecraft:cooked_rabbit, minecraft:mushroom_stew, minecraft:baked_potato, minecraft:pumpkin_pie |
| minecraft:is_hoe | minecraft:netherite_hoe, minecraft:wooden_hoe, minecraft:iron_hoe, minecraft:stone_hoe, minecraft:golden_hoe, minecraft:diamond_hoe |
| minecraft:is_meat | minecraft:cooked_porkchop, minecraft:rabbit_stew, minecraft:chicken, minecraft:porkchop, minecraft:beef, minecraft:cooked_chicken, minecraft:mutton, minecraft:rabbit, minecraft:rotten_flesh, minecraft:cooked_beef, minecraft:cooked_mutton, minecraft:cooked_rabbit |
| minecraft:is_minecart | minecraft:tnt_minecart, minecraft:command_block_minecart, minecraft:chest_minecart, minecraft:minecart, minecraft:hopper_minecart |
| minecraft:is_pickaxe | minecraft:wooden_pickaxe, minecraft:golden_pickaxe, minecraft:netherite_pickaxe, minecraft:diamond_pickaxe, minecraft:stone_pickaxe, minecraft:iron_pickaxe |
| minecraft:is_shovel | minecraft:wooden_shovel, minecraft:stone_shovel, minecraft:iron_shovel, minecraft:golden_shovel, minecraft:diamond_shovel, minecraft:netherite_shovel |
| minecraft:is_sword | minecraft:netherite_sword, minecraft:stone_sword, minecraft:iron_sword, minecraft:golden_sword, minecraft:wooden_sword, minecraft:diamond_sword |
| minecraft:is_tool | minecraft:wooden_pickaxe, minecraft:golden_pickaxe, minecraft:netherite_sword, minecraft:netherite_hoe, minecraft:wooden_shovel, minecraft:wooden_hoe, minecraft:stone_sword, minecraft:golden_axe, minecraft:iron_axe, minecraft:netherite_pickaxe, minecraft:iron_hoe, minecraft:wooden_axe, minecraft:iron_sword, minecraft:stone_hoe, minecraft:stone_shovel, minecraft:golden_sword, minecraft:stone_axe, minecraft:diamond_pickaxe, minecraft:netherite_axe, minecraft:wooden_sword, minecraft:diamond_sword, minecraft:diamond_axe, minecraft:stone_pickaxe, minecraft:iron_pickaxe, minecraft:iron_shovel, minecraft:golden_shovel, minecraft:diamond_shovel, minecraft:netherite_shovel, minecraft:golden_hoe, minecraft:diamond_hoe |
| minecraft:is_trident | minecraft:trident |
| minecraft:leather_tier | minecraft:leather_boots, minecraft:leather_helmet, minecraft:leather_leggings, minecraft:leather_chestplate |
| minecraft:lectern_books | minecraft:writable_book |
| minecraft:logs | minecraft:dark_oak_log, minecraft:warped_stem, minecraft:stripped_warped_stem, minecraft:mangrove_log, minecraft:jungle_log, minecraft:birch_log, minecraft:stripped_crimson_stem, minecraft:stripped_jungle_log, minecraft:stripped_crimson_hyphae, minecraft:oak_log, minecraft:wood, minecraft:warped_hyphae, minecraft:stripped_oak_log, minecraft:stripped_cherry_wood, minecraft:stripped_mangrove_wood, minecraft:stripped_cherry_log, minecraft:stripped_warped_hyphae, minecraft:crimson_stem, minecraft:stripped_birch_log, minecraft:crimson_hyphae, minecraft:stripped_dark_oak_log, minecraft:stripped_acacia_log, minecraft:stripped_mangrove_log, minecraft:stripped_spruce_log, minecraft:spruce_log, minecraft:acacia_log, minecraft:mangrove_wood, minecraft:cherry_log, minecraft:cherry_wood, minecraft:log, minecraft:log2 |
| minecraft:logs_that_burn | minecraft:dark_oak_log, minecraft:mangrove_log, minecraft:jungle_log, minecraft:birch_log, minecraft:stripped_jungle_log, minecraft:oak_log, minecraft:wood, minecraft:stripped_oak_log, minecraft:stripped_cherry_wood, minecraft:stripped_mangrove_wood, minecraft:stripped_cherry_log, minecraft:stripped_birch_log, minecraft:stripped_dark_oak_log, minecraft:stripped_acacia_log, minecraft:stripped_mangrove_log, minecraft:stripped_spruce_log, minecraft:spruce_log, minecraft:acacia_log, minecraft:mangrove_wood, minecraft:cherry_log, minecraft:cherry_wood, minecraft:log, minecraft:log2 |
| minecraft:mangrove_logs | minecraft:mangrove_log, minecraft:stripped_mangrove_wood, minecraft:stripped_mangrove_log, minecraft:mangrove_wood |
| minecraft:music_disc | minecraft:music_disc_strad, minecraft:music_disc_11, minecraft:music_disc_mellohi, minecraft:music_disc_otherside, minecraft:music_disc_wait, minecraft:music_disc_relic, minecraft:music_disc_5, minecraft:music_disc_stal, minecraft:music_disc_pigstep, minecraft:music_disc_blocks, minecraft:music_disc_cat, minecraft:music_disc_far, minecraft:music_disc_13, minecraft:music_disc_chirp, minecraft:music_disc_mall, minecraft:music_disc_ward |
| minecraft:netherite_tier | minecraft:netherite_sword, minecraft:netherite_hoe, minecraft:netherite_pickaxe, minecraft:netherite_helmet, minecraft:netherite_chestplate, minecraft:netherite_leggings, minecraft:netherite_boots, minecraft:netherite_axe, minecraft:netherite_shovel |
| minecraft:planks | minecraft:dark_oak_planks, minecraft:spruce_planks, minecraft:oak_planks, minecraft:birch_planks, minecraft:acacia_planks, minecraft:bamboo_planks, minecraft:jungle_planks, minecraft:warped_planks, minecraft:mangrove_planks, minecraft:cherry_planks, minecraft:crimson_planks, minecraft:planks |
| minecraft:sand | minecraft:sand |
| minecraft:sign | minecraft:oak_sign, minecraft:jungle_sign, minecraft:warped_hanging_sign, minecraft:cherry_sign, minecraft:birch_sign, minecraft:crimson_hanging_sign, minecraft:acacia_hanging_sign, minecraft:bamboo_hanging_sign, minecraft:dark_oak_hanging_sign, minecraft:acacia_sign, minecraft:jungle_hanging_sign, minecraft:spruce_sign, minecraft:dark_oak_sign, minecraft:cherry_hanging_sign, minecraft:oak_hanging_sign, minecraft:mangrove_sign, minecraft:birch_hanging_sign, minecraft:mangrove_hanging_sign, minecraft:bamboo_sign, minecraft:crimson_sign, minecraft:warped_sign, minecraft:spruce_hanging_sign |
| minecraft:soul_fire_base_blocks | minecraft:soul_sand, minecraft:soul_soil |
| minecraft:spawn_egg | minecraft:blaze_spawn_egg, minecraft:piglin_brute_spawn_egg, minecraft:ghast_spawn_egg, minecraft:bee_spawn_egg, minecraft:hoglin_spawn_egg, minecraft:wolf_spawn_egg, minecraft:rabbit_spawn_egg, minecraft:drowned_spawn_egg, minecraft:ender_dragon_spawn_egg, minecraft:glow_squid_spawn_egg, minecraft:fox_spawn_egg, minecraft:pig_spawn_egg, minecraft:piglin_spawn_egg, minecraft:ravager_spawn_egg, minecraft:endermite_spawn_egg, minecraft:frog_spawn_egg, minecraft:elder_guardian_spawn_egg, minecraft:iron_golem_spawn_egg, minecraft:axolotl_spawn_egg, minecraft:panda_spawn_egg, minecraft:spider_spawn_egg, minecraft:strider_spawn_egg, minecraft:chicken_spawn_egg, minecraft:cod_spawn_egg, minecraft:shulker_spawn_egg, minecraft:pillager_spawn_egg, minecraft:slime_spawn_egg, minecraft:salmon_spawn_egg, minecraft:creeper_spawn_egg, minecraft:polar_bear_spawn_egg, minecraft:llama_spawn_egg, minecraft:goat_spawn_egg, minecraft:trader_llama_spawn_egg, minecraft:wither_spawn_egg, minecraft:parrot_spawn_egg, minecraft:horse_spawn_egg, minecraft:sniffer_spawn_egg, minecraft:husk_spawn_egg, minecraft:bat_spawn_egg, minecraft:turtle_spawn_egg, minecraft:sheep_spawn_egg, minecraft:tropical_fish_spawn_egg, minecraft:evoker_spawn_egg, minecraft:vex_spawn_egg, minecraft:skeleton_horse_spawn_egg, minecraft:tadpole_spawn_egg, minecraft:cow_spawn_egg, minecraft:villager_spawn_egg, minecraft:cat_spawn_egg, minecraft:warden_spawn_egg, minecraft:skeleton_spawn_egg, minecraft:cave_spider_spawn_egg, minecraft:magma_cube_spawn_egg, minecraft:zombie_pigman_spawn_egg, minecraft:pufferfish_spawn_egg, minecraft:wandering_trader_spawn_egg, minecraft:dolphin_spawn_egg, minecraft:spawn_egg, minecraft:ocelot_spawn_egg, minecraft:mooshroom_spawn_egg, minecraft:donkey_spawn_egg, minecraft:mule_spawn_egg, minecraft:zombie_horse_spawn_egg, minecraft:enderman_spawn_egg, minecraft:silverfish_spawn_egg, minecraft:wither_skeleton_spawn_egg, minecraft:stray_spawn_egg, minecraft:zombie_spawn_egg, minecraft:squid_spawn_egg, minecraft:witch_spawn_egg, minecraft:guardian_spawn_egg, minecraft:zoglin_spawn_egg, minecraft:allay_spawn_egg, minecraft:camel_spawn_egg, minecraft:vindicator_spawn_egg, minecraft:zombie_villager_spawn_egg, minecraft:phantom_spawn_egg, minecraft:snow_golem_spawn_egg |
| minecraft:stone_bricks | minecraft:stonebrick |
| minecraft:stone_crafting_materials | minecraft:cobbled_deepslate, minecraft:cobblestone, minecraft:blackstone |
| minecraft:stone_tier | minecraft:stone_sword, minecraft:stone_hoe, minecraft:stone_shovel, minecraft:stone_axe, minecraft:stone_pickaxe |
| minecraft:stone_tool_materials | minecraft:cobbled_deepslate, minecraft:cobblestone, minecraft:blackstone |
| minecraft:transform_materials | minecraft:netherite_ingot |
| minecraft:transform_templates | minecraft:netherite_upgrade_smithing_template |
| minecraft:transformable_items | minecraft:diamond_chestplate, minecraft:diamond_boots, minecraft:diamond_helmet, minecraft:diamond_pickaxe, minecraft:diamond_leggings, minecraft:golden_boots, minecraft:diamond_sword, minecraft:diamond_axe, minecraft:diamond_shovel, minecraft:diamond_hoe |
| minecraft:transformable_items | minecraft:gold_ingot, minecraft:redstone, minecraft:diamond, minecraft:netherite_ingot, minecraft:copper_ingot, minecraft:lapis_lazuli, minecraft:emerald, minecraft:iron_ingot, minecraft:amethyst_shard, minecraft:quartz |
| minecraft:trim_templates | minecraft:eye_armor_trim_smithing_template, minecraft:raiser_armor_trim_smithing_template, minecraft:sentry_armor_trim_smithing_template, minecraft:host_armor_trim_smithing_template, minecraft:snout_armor_trim_smithing_template, minecraft:spire_armor_trim_smithing_template, minecraft:wayfinder_armor_trim_smithing_template, minecraft:ward_armor_trim_smithing_template, minecraft:vex_armor_trim_smithing_template, minecraft:wild_armor_trim_smithing_template, minecraft:coast_armor_trim_smithing_template, minecraft:dune_armor_trim_smithing_template, minecraft:shaper_armor_trim_smithing_template, minecraft:silence_armor_trim_smithing_template, minecraft:tide_armor_trim_smithing_template, minecraft:rib_armor_trim_smithing_template |
| minecraft:trimmable_armors | minecraft:iron_boots, minecraft:turtle_helmet, minecraft:chainmail_leggings, minecraft:diamond_chestplate, minecraft:diamond_boots, minecraft:leather_boots, minecraft:golden_chestplate, minecraft:netherite_helmet, minecraft:golden_leggings, minecraft:iron_leggings, minecraft:diamond_helmet, minecraft:iron_chestplate, minecraft:chainmail_helmet, minecraft:leather_helmet, minecraft:chainmail_chestplate, minecraft:netherite_chestplate, minecraft:netherite_leggings, minecraft:netherite_boots, minecraft:leather_leggings, minecraft:chainmail_boots, minecraft:iron_helmet, minecraft:golden_helmet, minecraft:leather_chestplate, minecraft:diamond_leggings, minecraft:golden_boots |
| minecraft:vibration_damper | minecraft:white_wool, minecraft:green_wool, minecraft:magenta_wool, minecraft:gray_wool, minecraft:orange_wool, minecraft:orange_carpet, minecraft:gray_carpet, minecraft:red_carpet, minecraft:cyan_carpet, minecraft:light_gray_wool, minecraft:red_wool, minecraft:pink_wool, minecraft:brown_wool, minecraft:purple_carpet, minecraft:light_blue_carpet, minecraft:white_carpet, minecraft:black_wool, minecraft:wool, minecraft:light_blue_wool, minecraft:light_gray_carpet, minecraft:yellow_wool, minecraft:lime_wool, minecraft:cyan_wool, minecraft:black_carpet, minecraft:blue_wool, minecraft:purple_wool, minecraft:pink_carpet, minecraft:brown_carpet, minecraft:green_carpet, minecraft:yellow_carpet, minecraft:lime_carpet, minecraft:blue_carpet, minecraft:magenta_carpet, minecraft:carpet |
| minecraft:warped_stems | minecraft:warped_stem, minecraft:stripped_warped_stem, minecraft:warped_hyphae, minecraft:stripped_warped_hyphae |
| minecraft:wooden_slabs | minecraft:warped_slab, minecraft:wooden_slab, minecraft:crimson_slab, minecraft:bamboo_slab, minecraft:mangrove_slab, minecraft:cherry_slab |
| minecraft:wooden_tier | minecraft:wooden_pickaxe, minecraft:wooden_shovel, minecraft:wooden_hoe, minecraft:wooden_axe, minecraft:wooden_sword |
| minecraft:wool | minecraft:white_wool, minecraft:green_wool, minecraft:magenta_wool, minecraft:gray_wool, minecraft:orange_wool, minecraft:light_gray_wool, minecraft:red_wool, minecraft:pink_wool, minecraft:brown_wool, minecraft:black_wool, minecraft:wool, minecraft:light_blue_wool, minecraft:yellow_wool, minecraft:lime_wool, minecraft:cyan_wool, minecraft:blue_wool, minecraft:purple_wool |

View File

@@ -0,0 +1,156 @@
---
title: Intro to Items
description: A "Hello world" guide in making items. Learn the item format and how to create basic custom items.
category: General
nav_order: 1
tags:
- guide
- beginner
mentions:
- SirLich
- solvedDev
- Joelant05
- yanasakana
- destruc7ion
- aexer0e
- stirante
- ChibiMango
- MedicalJewel105
- Sprunkles317
- mark-wiemer
- TheItsNameless
- s1050613
- SmokeyStack
---
Minecraft Bedrock allows us to add custom items into our world with various vanilla-like properties
This tutorial will cover how to create basic items for the stable version of Minecraft.
## Registering Items
Item definitions are structured similarly to entities: they contain a description and a list of components that defines the item's behavior.
Below is the **minimum** behavior-side code to get a custom item into the creative inventory.
<CodeHeader>BP/items/custom_item.json</CodeHeader>
```json
{
"format_version": "1.20.50",
"minecraft:item": {
"description": {
"identifier": "wiki:custom_item",
"menu_category": {
"category": "construction"
}
},
"components": {} // Must be here, even if empty!
}
}
```
### Item Description
- Defines the item's identifier - a unique ID in the format of `namespace:identifier`.
- Configures which `menu_category` the item is placed into.
- Also takes the optional parameters `group` and `is_hidden_in_commands`.
## Adding Components
Right now, our custom item is using the default component values (which can be found [here](/items/item-components)).
Let's configure our own functionality!
<CodeHeader>BP/items/custom_item.json</CodeHeader>
```json
{
"format_version": "1.20.50",
"minecraft:item": {
"description": {
"identifier": "wiki:custom_item",
"menu_category": {
"category": "construction"
}
},
"components": {
"minecraft:damage": {
"value": 10
},
"minecraft:durability":{
"max_durability": 36
},
"minecraft:hand_equipped": {
"value": true
}
}
}
}
```
Browse more item components [here](/items/item-components)!
## Applying Textures
We need to create a texture shortname to link it to an image in `RP/textures/item_texture.json`.
<CodeHeader>RP/textures/item_texture.json</CodeHeader>
```json
{
"resource_pack_name": "wiki",
"texture_name": "atlas.items",
"texture_data": {
"custom_item": {
"textures": "textures/items/custom_item"
}
}
}
```
In our item file, we will add the `minecraft:icon` component to apply the texture.
<CodeHeader>BP/items/custom_item.json</CodeHeader>
```json
{
"format_version": "1.20.50",
"minecraft:item": {
"description": {
"identifier": "wiki:custom_item",
"menu_category": {
"category": "construction"
}
},
"components": {
"minecraft:icon": {
"texture": "custom_item"
}
}
}
}
```
## Defining Names
Finally, we will give our item a name. Additionally, you can use the [Display Name](/items/item-components#display_name) component.
<CodeHeader>RP/texts/en_US.lang</CodeHeader>
```c
tile.wiki:custom_item.name=Custom Item
```
## Result
In this page, you've learnt about the following:
<Checklist>
- [x] Basic features of items
- [x] How to apply a texture
- [x] How to link textures using shortnames in `item_textures.json`
- [x] How to define names in the language file
</Checklist>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,176 @@
---
title: Spawning Items
category: Tutorials
tags:
- intermediate
mentions:
- SirLich
- Joelant05
- Dreamedc2015
- yanasakana
- MedicalJewel105
- aexer0e
- Xterionix
---
It is fairly common to want to spawn an item in the world, as if dropped. This page will walk through how to accomplish this through various methods, including Entity Deaths, Interactions, and an all-purpose method.
## /loot
The simplest method of spawning items to date is by using /loot. Formatted as such:
```
/loot spawn ~ ~ ~ loot "entities/cow"
```
<CodeHeader>BP/loot_tables/entities/cow.json</CodeHeader>
```json
"minecraft:loot": {
"table": "loot_tables/entities/cow.json"
}
```
## Entity Deaths
Another simple method of spawning items - and generally the most common one - is dropping items upon an entity's death. This is done by adding the `minecraft:loot` component to the entity and linking it to the respective loot table (`forium` in the following example) containing items you wish to be dropped.
<CodeHeader>BP/entities/my_entity.json#components</CodeHeader>
```json
"minecraft:loot": {
"table": "loot_tables/entities/forium.json"
}
```
## Dummy Entity Deaths
We can use `minecraft:loot` on a [dummy entity](/entities/dummy-entities) that dies when we spawn it to create a `drop_entity`. This entity can be summoned like `/summon wiki:drop_entity` to spawn the items. This is useful for scenarios where death particles or sounds are not an issue.
Behaviors:
<CodeHeader>BP/entities/my_entity.json</CodeHeader>
```json
{
"format_version": "1.16.0",
"minecraft:entity": {
"description": {
"identifier": "wiki:drop_entity",
"is_spawnable": true,
"is_summonable": true,
"is_experimental": false
},
"components": {
// Causes the entity to die when spawned
"minecraft:health": {
"value": 0
},
"minecraft:loot": {
"table": "loot_tables/entities/some_loot.json"
}
}
}
}
```
## Interactions
Here is an example of an entity called "box" which will drop its contents upon interaction. The table in `spawn_items` is linked to the loot table with the items desired to be dropped. In this particular case, the event `break_box` is also called when the entity is interacted with, adding a component group that removes the box.
Note that if the entity is not removed upon interaction, it can be interacted with again and will spawn the items. If the entity should persist after the interaction, the `cooldown` parameter may be added to the entity to prevent interaction for a specified amount of time. Alternatively, an event may be called to remove the component group containing this `minecraft:interact` component.
<CodeHeader>BP/entities/my_entity.json#components</CodeHeader>
```json
"minecraft:interact": {
"interactions": [
{
"on_interact": {
"filters": {
"test": "is_family",
"subject": "other",
"value": "player"
},
"event": "break_box",
"target": "self"
},
"swing": true,
"spawn_items": {
"table": "loot_tables/entities/box.json"
}
}
]
}
```
## All-Purpose Method
This is a method that can be used for virtually any scenario: entity deaths, animation-based interactions, general item drops. This method was created in particular for dropping items without any death animation, sound, or particles.
Several parts are required to set up the item dropping: a new entity with behavior, a corresponding animation controller, the resources for an invisible entity (refer to Dummy Entities tutorial), and a loot table. To spawn the items after it is set up, the entity is spawned where the items are to be dropped. If multiple items are desired, component groups with spawn events may be set up for each item.
### Behavior
The items are spawned using the `minecraft:behavior.drop_item_for` component in conjunction with the `minecraft:navigation.walk` component, the latter being required for the former to work. Note that the `time_of_day_range` parameter in the following is not initialized to how it is defined below despite the documentation listing it as such, and this is necessary for proper function. The parameter `max_dist` must be increased to an appropriate value if the items are desired to be dropped when the player is very far away.
This behavior appears to push the mob back when the items are dropped. Thus it is essential to summon the entity slightly above the ground (or teleport it up in the following animation controller) to avoid the items spawning a few blocks away from the spawn location. Decreasing the size of the collision box may also help.
<CodeHeader>BP/entities/my_entity.json#components</CodeHeader>
```json
"minecraft:navigation.walk": {},
"minecraft:behavior.drop_item_for": {
"priority": 1,
"max_dist": 16,
"loot_table": "loot_tables/entities/forium.json",
"time_of_day_range": [0.0, 1.0]
}
```
### Animation Controller
**The following animation controller must be linked to the entity** to remove it upon summoning. Alternatively, an animation with a timeline can be used. If you are unsure how to do this, refer to the Entity Commands tutorial.
Teleporting the entity into the void causes no death animation, sound, or particles. Two transitions are used to ensure it is not killed in the same tick it spawns.
<CodeHeader>BP/animation_controllers/my_entity.ac.json</CodeHeader>
```json
{
"format_version": "1.10.0",
"animation_controllers": {
"controller.animation.drop_items.die": {
"initial_state": "spawn",
"states": {
"spawn": {
"transitions": [
{
"delay": "1"
}
]
},
"delay": {
"transitions": [
{
"die": "1"
}
]
},
"die": {
"on_entry": ["/tp @s ~ -200 ~"]
}
}
}
}
}
```
## Structure Method
There is also one interesting method of spawning items - via structure.
You can fill a structure with `structure_void` (so air doesn't replace blocks when structure loaded) and drop an item into it.
This method allows us to keep item data (such as durability).
Then you can load this structure whenever and wherever you want.
![](/assets/images/items/spawning-items/structure-method.png)

402
docs/wiki/items/spear.md Normal file
View File

@@ -0,0 +1,402 @@
---
title: Custom Spear
category: Tutorials
tags:
- scripting
mentions:
- XxPoggyisLitxX
- SirLich
- TheItsNamless
- ThomasOrs
- kumja1
hidden: true
---
::: tip
It's highly recommended that you have a basic understanding of JavaScript and Script-API.
:::
::: warning
It's highly recommended that you have made the basic textures and models for this guide..
:::
Before we start, let's make sure you have your file structure set up:
<FolderView
:paths="[
'com.mojang/development_resource_packs/spear_RP/textures/items/spear.png',
'com.mojang/development_resource_packs/spear_RP/textures/entities/spear.png',
'com.mojang/development_resource_packs/spear_RP/entities/spear.json',
'com.mojang/development_resource_packs/spear_RP/attachables/spear.json',
'com.mojang/development_resource_packs/spear_RP/animations/spear_animation.json',
'com.mojang/development_resource_packs/spear_RP/texts/en_US.lang',
'com.mojang/development_resource_packs/spear_RP/manifest.json',
'com.mojang/development_resource_packs/spear_RP/pack_icon.png',
'com.mojang/development_behavior_packs/spear_BP/items/spear.json',
'com.mojang/development_behavior_packs/spear_BP/entities/spear.json',
'com.mojang/development_behavior_packs/spear_BP/pack_icon.png',
'com.mojang/development_behavior_packs/spear_BP/manifest.json'
]"
></FolderView>
Making custom spears is a really simple task. It was not simple for Koala Boy though. There are some scripting involved, but it doesn't do the main behaviors.
## Item
It can go without saying that you'd obviously need an item to make a spear, however we don't use some "basic" behaviors. Let's get an item file and let's add the following components. Let's start with the main components:
<CodeHeader>BP/items/spear.json</CodeHeader>
```json
{
//Use duration is the max time we can use the item.
"minecraft:use_duration": 3600,
//This component is what gives our spear the ability to 'draw' it like a bow
"minecraft:throwable": {
"min_draw_duration": 2,
"max_draw_duration": 4,
"scale_power_by_draw_duration": true
},
//What projectile to shoot when draw is complete
"minecraft:projectile": {
"projectile_entity": "wiki:thrown_iron_spear",
"minimum_critical_power": 1.0
},
//Durability of the spear.
"minecraft:durability": {
"max_durability": 125
}
}
```
## Spear Projectile
We can safely say that we got the important components for our spear. Next we move over to the projectile. This projectile will be a simple entity, with some added components and a runtime identifier to get the correct behaviors.
<Spoiler title="Projectile">
<CodeHeader>BP/entities/spear.json</CodeHeader>
```json
{
"format_version": "1.12.0",
"minecraft:entity": {
"description": {
"identifier": "wiki:thrown_iron_spear",
"is_spawnable": false,
"is_summonable": true,
"is_experimental": false,
"runtime_identifier": "minecraft:snowball"
},
"component_groups": {
"wiki:give": {
"minecraft:instant_despawn": {}
}
},
"components": {
"minecraft:conditional_bandwidth_optimization": {
"default_values": {
"max_dropped_ticks": 10,
"max_optimized_distance": 100,
"use_motion_prediction_hints": true
}
},
"minecraft:hurt_on_condition": {
"damage_conditions": [
{
"cause": "lava",
"damage_per_tick": 4,
"filters": {
"operator": "==",
"subject": "self",
"test": "in_lava",
"value": true
}
}
]
},
"minecraft:physics": {},
"minecraft:projectile": {
"anchor": 1,
"gravity": 0.05,
"hit_sound": "bow.hit",
"offset": [
0,
-0.1,
0
],
"on_hit": {
"definition_event": {
"event_trigger": {
"event": "example:foo",
"target": "self"
}
},
"impact_damage": {
"damage": 7,
"destroy_on_hit": false,
"knockback": true,
"power_multiplier": 0.97,
"semi_random_diff_damage": false
},
"stick_in_ground": {
"shake_time": 0.35
}
},
"power": 3,
"should_bounce": true,
"stop_on_hurt": true
},
"minecraft:pushable": {
"is_pushable": false,
"is_pushable_by_piston": true
}
}
}
}
```
</Spoiler>
Here we got our simple projectile entity. We are missing one part to make this a useful projectile. There is no way for our player to pick it up from the ground. In order to do this, we need events and entity sensors:
<CodeHeader>BP/entities/spear.json</CodeHeader>
```json
{
"components": {
//Entity sensor detects if the projectile is on the ground, and if the player is near the entity.
//This will run an event when it's true
"minecraft:entity_sensor": {
"event": "wiki:give",
"event_filters": {
"all_of": [
{
"subject": "other",
"test": "is_family",
"value": "player"
},
{
"subject": "self",
"test": "on_ground",
"value": true
}
]
},
"minimum_count": 1,
"relative_range": false,
"sensor_range": 0.7
}
},
"events": {
/*
This event will despawn our projectile, and give our player a tag, which we will use in our script.
*/
"wiki:give": {
"sequence": [
{
"add": {
"component_groups": [
"wiki:give"
]
}
},
{
"randomize": [
{
"run_command": {
"command": [
"playsound random.pop @p",
"tag @p add iron_spear"
]
},
"weight": 90
}
]
}
]
}
}
}
```
Once we're done with out projectile entity, it's time to go to Resource Packs.
## Client Entity
We will be using a basic client entity file for our projectile with added code.
<Spoiler title="Client Entity">
<CodeHeader>RP/entities/spear.json</CodeHeader>
```json
{
"format_version": "1.10.0",
"minecraft:client_entity": {
"description": {
"identifier": "wiki:thrown_iron_spear",
"materials": {
"default": "entity_alphatest"
},
"textures": {
"default": "textures/entity/iron_spear"
},
"animations": {
"move": "animation.weapon.default_thrown"
},
"scripts": {
"animate": [
"move"
]
},
"geometry": {
"default": "geometry.stone_spear"
},
"render_controllers": [
"controller.render.default"
]
}
}
}
```
</Spoiler>
Inside our client entity file, you might have noticed that there is animations bound to it. This animation will make our projectile rotate as it flies.
:::warning
Make sure your entity model is modeled like the image bellow!
:::
![](/assets/images/items/spears/spear_model.png)
## Animation
The animation we use for our projectile isn't you normal entity animation. This one uses [molang](https://bedrock.dev/docs/stable/Molang) to define rotations.
<CodeHeader>BP/animations/spear.json</CodeHeader>
```json
{
"format_version": "1.8.0",
"animations": {
"animation.weapon.default_thrown": {
"loop": true,
"bones": {
"body": {
//This is some molang stuff. The animation uses this to rotate the model based on its current angle.
"rotation": ["-q.target_x_rotation", "-q.body_y_rotation", 0]
}
}
}
}
}
```
## Attachable
We will be using the Trident Attachable because it comes with item positions and use animations already. It should look like this:
<CodeHeader>BP/attachables/spear.json</CodeHeader>
```json
{
"format_version": "1.10.0",
"minecraft:attachable": {
"description": {
"identifier": "wiki:iron_spear",
"materials": {
"default": "entity_alphatest",
"enchanted": "entity_alphatest_glint"
},
"textures": {
"default": "textures/entity/iron_spear",
"enchanted": "textures/misc/enchanted_item_glint"
},
"geometry": {
"default": "geometry.stone_spear_item"
},
"animations": {
"wield": "controller.animation.trident.wield",
"wield_first_person": "animation.trident.wield_first_person",
"wield_first_person_raise": "animation.trident.wield_first_person_raise",
"wield_first_person_raise_shake": "animation.trident.wield_first_person_raise_shake",
"wield_first_person_riptide": "animation.trident.wield_first_person_riptide",
"wield_third_person": "animation.trident.wield_third_person",
"wield_third_person_raise": "animation.trident.wield_third_person_raise"
},
"scripts": {
"pre_animation": [
"v.charge_amount = math.clamp((q.main_hand_item_max_duration - (q.main_hand_item_use_duration - q.frame_alpha + 1.0)) / 10.0, 0.0, 1.0f);"
],
"animate": [
"wield"
]
},
"render_controllers": [
"controller.render.item_default"
]
}
}
}
```
## Script
Now that we've setup our spear, there is no way to damage the spear when it's thrown. To do this, we will make use of Script-API.
The script is really simple, and wouldn't require much brain power.
```js
import { world, ItemStack } from "@minecraft/server"
import { system } from "@minecraft/server";
//This prevents world crash
system.beforeEvents.watchdogTerminate.subscribe(data => {
data.cancel = true;
});
world.afterEvents.itemReleaseUse.subscribe(ev => {
//This is for multiplayer support
for (const player of world.getPlayers()){
//Basic variables to get the player inventory and held item.
let inv = player.getComponent( 'inventory' ).container
//Our itemStack to save our item. This also saves item data.
const itemStack = inv.getItem(player.selectedSlot);
//If the item we're holding is our spear, we run code.
if (itemStack?.typeId === 'wiki:iron_spear') {
var container = player.getComponent('inventory').container
//The new item to be given.
var newItem = new ItemStack("wiki:iron_spear");
var oldItem = container?.getItem(player.selectedSlot)
//Here's that tag!
player.removeTag("iron_spear")
}
//We subscribe a tick event to detect when we have the tag and if the item has durability less than the max.
let e = system.runInterval(() => {
if(player.hasTag("iron_spear") && itemStack?.typeId === 'wiki:iron_spear' && itemStack?.getComponent("durability").damage <= 125) {
player.removeTag("iron_spear")
//This gives our saved item (newItem) +1 durability each time we pick it up.
newItem.getComponent("durability").damage = oldItem.getComponent("durability").damage + 1;
container.setItem(player.selectedSlot, newItem);
//When we don't have the tag, we stop the tick event.
if(!player.hasTag("iron_spear")){
system.clearRun(e);
}}
})}
})
```
## Final Product
Once you've followed this guide, you should have your own working spear in-game.
![](/assets/images/items/spears/spear_first_person.png)
![](/assets/images/items/spears/spear_third_person.png)
Example Pack Download:
<BButton
link="https://github.com/Bedrock-OSS/wiki-addon/releases/download/download/custom_spear.mcaddon"
color=blue
>💾 Example Pack</BButton>

View File

@@ -0,0 +1,382 @@
---
title: Throwable Items
category: Tutorials
tags:
- intermediate
mentions:
- Fabrimat
- MedicalJewel105
- Luthorius
- IlkinQafarov
- seeit360
- TheItsNameless
- SmokeyStack
- ThomasOrs
---
::: tip
This tutorial assumes you have a basic understanding of Molang, animation controllers and entity definitions.
:::
Items like the Splash Potion or the Trident are special items that can be thrown. Currently, there are two ways to accomplish something similar in your add-on, one that can be done in the stable release and one that needs the `Holiday Creator Features` experimental toggle to be enabled.
## Stable method
This method lets you detect the usage of an item through the `minecraft:food` component from an animation controller, and modifying the `player.json` you can then spawn an entity when that happens.
### The Item
First, you'll want to make the actual item:
<CodeHeader>BP/items/throwable_item.item.json</CodeHeader>
```json
{
"format_version": "1.16.0",
"minecraft:item": {
"description": {
"identifier": "wiki:throwable_item"
},
"components": {
"minecraft:max_stack_size": 16,
"minecraft:use_duration": 12000,
"minecraft:food": {
"can_always_eat": true
}
}
}
}
```
We can notice several things here:
- `format_version` must be `1.16.0`
- `minecraft:use_duration` should be a high number, in order to stop the eating sound to play and to prevent the player from eating the item
- `minecraft:food` is used to allow player to actually "use" the item, so we can detect it
Because the format version is `1.16.0`, your item needs an RP definition too:
<CodeHeader>RP/items/throwable_item.item.json</CodeHeader>
```json
{
"format_version": "1.16.0",
"minecraft:item": {
"description": {
"identifier": "wiki:throwable_item",
"category": "Equipment"
},
"components": {
"minecraft:icon": "throwable_item"
}
}
}
```
### The Entity
The entity will be the actual thrown item, and it will behave like a projectile.
Make sure to add snowball runtime identifier to make your projectile to actually be shoot, not spawned. You can also experiment with other projectile runtime id's.
<CodeHeader>BP/entities/throwable_item_entity.se.json</CodeHeader>
```json
{
"format_version": "1.16.0",
"minecraft:entity": {
"description": {
"identifier": "wiki:throwable_item_entity",
"is_spawnable": false,
"is_summonable": true,
"is_experimental": false,
"runtime_identifier": "minecraft:snowball"
},
"components": {
"minecraft:collision_box": {
"width": 0.25,
"height": 0.25
},
"minecraft:projectile": {
"on_hit": {
"grant_xp": {
"minXP": 3,
"maxXP": 5
},
"impact_damage": {
"damage": 16
},
"remove_on_hit": {}
},
"power": 0.7,
"gravity": 0.03,
"angle_offset": -20.0,
"hit_sound": "glass"
},
"minecraft:physics": {},
"minecraft:pushable": {
"is_pushable": true,
"is_pushable_by_piston": true
},
"minecraft:conditional_bandwidth_optimization": {
"default_values": {
"max_optimized_distance": 80.0,
"max_dropped_ticks": 10,
"use_motion_prediction_hints": true
}
}
}
}
}
```
This entity is based on the Vanilla splash potion.
You can then customize its behavior by editing the `minecraft:projectile` component, in this case the thrown item will grant some exp and will damage any entity it will hit.
### The Animation Controller
The animation controller is responsible for detecting the usage of the item and for telling the player entity to spawn a throwable entity.
<CodeHeader>BP/animation_controllers/throwables.ac.json</CodeHeader>
```json
{
"format_version": "1.10.0",
"animation_controllers": {
"controller.animation.player.throwables": { // The ID we will reference in the player's entity description
"states": {
"default": {
"transitions": [
{
// Current "q.is_item_name_any" takes 3 arguments, first is slot name, second is slot id, third is the item we want to check for
"throw_item": "q.is_item_name_any('slot.weapon.mainhand', 0, 'wiki:throwable_item') && q.is_using_item"
// "q.is_using_item" returns 'true' or 'false', in our case if player uses item it is going to return 'true'
}
],
"on_entry": [
// Resets the player entity in order to be able to throw another item
"@s wiki:reset_player"
]
},
"throw_item": {
"transitions": [
{
"default": "1.0"
}
],
"on_entry": [
// Call the event in the player entity responsible of throwing the item
"@s wiki:throw_item",
// Remove the item from player's inventory
"/clear @s wiki:throwable_item -1 1"
]
}
}
}
}
}
```
#### player.json
:::tip
Always make sure that your `player.json` file is updated to the latest version available, depending on the game version you are working on.
You can do that [here](https://bedrock.dev/packs).
:::
:::warning
Do not edit/remove existing parts of the `player.json` file unless you know what you are doing, as it could (and probably will) break the game.
:::
Now, you have to register the animation controller to the `player.json` file:
<CodeHeader>BP/entities/player.json</CodeHeader>
```json
{
"format_version": "1.18.20",
"minecraft:entity": {
"description": {
"identifier": "minecraft:player",
"is_spawnable": false,
"is_summonable": false,
"is_experimental": false,
"scripts": {
"animate": [
"throwables_controller" // This should exactly match the same as the one below
]
},
"animations": {
"throwables_controller": "controller.animation.player.throwables" // ID as referenced in animation controller file
}
},
"components": {
"minecraft:breathable": { // keeps breath timer bubbles from appearing
"total_supply": 15,
"suffocate_time": -1,
"inhale_time": 3.75,
"generates_bubbles": false
}
},
...
}
```
Then, you need to add all the events and component groups to the `player.json` file:
<CodeHeader>BP/entities/player.json#minecraft:entity</CodeHeader>
```json
"component_groups": {
"wiki:throw_entity": { // Contains a component that will spawn the entity
"minecraft:spawn_entity": {
"entities": {
"min_wait_time": 0,
"max_wait_time": 0,
"single_use": true,
"spawn_entity": "wiki:throwable_item_entity",
"num_to_spawn": 1
}
}
}
},
"events": {
"wiki:reset_player": {
"remove": {
"component_groups": [
"wiki:throw_entity"
]
}
},
"wiki:throw_item": {
"add": {
"component_groups": [
"wiki:throw_entity"
]
}
}
}
```
## Experimental method
This method requires the `Holiday Creator Features` experimental toggle to be enabled.
### The Item
<CodeHeader>BP/items/throwable_item.item.json</CodeHeader>
```json
{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "wiki:throwable_item"
},
"components": {
"minecraft:max_stack_size": 16,
"minecraft:on_use": {
"on_use": {
"event": "throw"
}
},
"minecraft:icon": {
"texture": "apple"
}
},
"events": {
"throw": {
"shoot": {
"projectile": "wiki:throwable_item_entity",
"launch_power": 2,
"angle_offset": 1
},
"swing": {},
"decrement_stack": {},
"run_command": {
"command": [
"playsound fire.ignite",
"playsound mob.witch.throw"
]
}
}
}
}
}
```
We can notice several things here:
- `format_version` must be `1.16.100`
- `minecraft:on_use` will call an event every time the item is used (right-clicked)
In the event:
- `shoot` will shoot our entity
- `swing` will run the swing animation on the player
- `decrement_stack` will remove one item from the player's inventory
- `run_command` will execute commands when the item is shot, like playing sounds
### The Entity
The entity file is the same as the Stable version.
<Spoiler title="BP/entities/throwable_item_entity.se.json">
<CodeHeader>BP/entities/throwable_item_entity.se.json</CodeHeader>
```json
{
"format_version": "1.16.0",
"minecraft:entity": {
"description": {
"identifier": "wiki:throwable_item_entity",
"is_spawnable": false,
"is_summonable": true,
"is_experimental": false,
"runtime_identifier": "minecraft:snowball"
},
"components": {
"minecraft:collision_box": {
"width": 0.25,
"height": 0.25
},
"minecraft:projectile": {
"on_hit": {
"grant_xp": {
"minXP": 3,
"maxXP": 5
},
"impact_damage": {
"damage": 16
},
"remove_on_hit": {}
},
"power": 0.7,
"gravity": 0.03,
"angle_offset": -20.0,
"hit_sound": "glass"
},
"minecraft:physics": {},
"minecraft:pushable": {
"is_pushable": true,
"is_pushable_by_piston": true
},
"minecraft:conditional_bandwidth_optimization": {
"default_values": {
"max_optimized_distance": 80.0,
"max_dropped_ticks": 10,
"use_motion_prediction_hints": true
}
}
}
}
}
```
</Spoiler>
## Conclusion
Once you have your throwable item you can start trying several things, like playing with its power, effects, animations or combining it with an [AOE Cloud](/entities/introduction-to-aec). The only limit is your imagination.

View File

@@ -0,0 +1,267 @@
---
title: Tool Durability
category: Tutorials
tags:
- experimental
- intermediate
- scripting
mentions:
- MedicalJewel105
- TheDoctor15
- napstaa967
---
## Introduction
1.16.100+ items have different durability mechanic than 1.10 and 1.16 items.
Now you need to define when will the item get durability damage and also an event that does it.
What will be discussed on this page:
- Durability component
- Event that updates durability
- Damaging entities
- Block breaking
- `repair_amount` value
- `on_tool_used` event
### Components
<CodeHeader>BP/items/my_item.json#components</CodeHeader>
```json
"minecraft:durability": {
"max_durability": 200
}
```
`minecraft:durability` will give your item a set max durability
## Event
### Item event
<CodeHeader>BP/items/my_item.json#events</CodeHeader>
```json
"durability_update": {
"damage": {
"type": "none",
"amount": 1,
"target": "self"
}
}
```
When this event is called the item (`self` target) will receive durability damage.
Looks simple, doesn't it?
### Script event
For the script methods, we'll be using a function to damage our item
This function supports unbreaking on items
<CodeHeader>BP/scripts/main.js</CodeHeader>
```js
function damage_item(item) {
// Get durability
const durabilityComponent = item.getComponent("durability")
var unbreaking = 0
// Get unbreaking level
if (item.hasComponent("enchantments")) {
unbreaking = item.getComponent("enchantments").enchantments.getEnchantment("unbreaking")
if (!unbreaking) {
unbreaking = 0
} else {
unbreaking = unbreaking.level
}
}
// Apply damage
if (durabilityComponent.damage == durabilityComponent.maxDurability) {
return
}
durabilityComponent.damage += Number(Math.round(Math.random() * 100) <= durabilityComponent.getDamageChance(unbreaking))
return item
}
```
## Damaging entities
### Using scripts
:::warning Experimental Script
This script uses `@minecraft/server 1.9.0-beta`, which will change in the next minecraft update.
:::
For format versions 1.20.40 and onward, `on_hurt_entity` no longer works.
This provides a way to damage weapons using scripts
<CodeHeader>BP/scripts/main.js</CodeHeader>
```js
// Add your item IDs into this array
const my_items = ["wiki:silver_dagger"]
world.afterEvents.entityHurt.subscribe(event => {
// If there's no source entity, skip
if (!event.damageSource.damagingEntity) return
// Get equipped weapon
const equipment = event.damageSource.damagingEntity.getComponent("minecraft:equippable")
if (!equipment) return
const weapon = equipment.getEquipment(EquipmentSlot.Mainhand)
// If there's no weapon, skip
if (!weapon) return
// If the item is not in our item IDs, skip
if (!my_items.includes(weapon.typeId)) return
let newItem = damage_item(weapon)
equipment.setEquipment(EquipmentSlot.Mainhand, newItem)
if (!newItem) {
if (event.damageSource.damagingEntity instanceof Player) {
event.damageSource.damagingEntity.playSound("random.break")
}
}
})
```
### on_hurt_entity
:::warning
`on_hurt_entity` was removed in format version 1.20.40
:::
`on_hurt_entity` can be defined in "minecraft:weapon" component. It tells the game what event should happen when player hurts entity using this item.
<CodeHeader>BP/items/my_item.json#components</CodeHeader>
```json
"minecraft:weapon": {
"on_hurt_entity": {
"event": "durability_update"
}
}
```
## Block breaking
### Using scripts
:::warning Experimental Script
This script uses `@minecraft/server 1.9.0-beta`, which will change in the next minecraft update.
:::
For format versions 1.20.20 and onward, `on_dig` no longer works.
This provides a way to damage digger items by using scripts
<CodeHeader>BP/scripts/main.js</CodeHeader>
```js
// Add your item IDs into this array
const my_items = ["wiki:obsidian_pickaxe"]
world.afterEvents.playerBreakBlock.subscribe(event => {
// If there's no item, skip
if (!event.itemStackAfterBreak) return
// If the item is not in our item IDs, skip
if (!my_items.includes(event.itemStackAfterBreak.typeId)) return
// If player is in creative, skip
if (world.getPlayers({
gameMode: GameMode.creative
}).includes(event.player)) return
const newItem = damage_item(event.itemStackAfterBreak)
event.player.getComponent("minecraft:equippable").setEquipment(EquipmentSlot.Mainhand, newItem)
if (!newItem) {
event.player.playSound("random.break")
}
})
```
### on_dig
:::warning
`on_dig` was removed in format version 1.20.20
:::
`on_dig` can be defined in "minecraft:digger" component. It tells the game what event should happen when player dug a block using this item.
<CodeHeader>BP/items/my_item.json#components</CodeHeader>
```json
"minecraft:digger": {
"use_efficiency": true,
"destroy_speeds": [
{
"block": {
"tags": "q.any_tag('wood')"
},
"speed": 8,
"on_dig": {
// Defines event that should happen when block with tag wood was dug.
"event": "durability_update"
}
}
],
"on_dig": {
// Defines event that should happen when any block was destroyed.
"event": "durability_update"
}
}
```
## repair_amount
`repair_amount` can be defined in "minecraft:repairable" component. It tells the game how much of the item's durability should be back when it was repaired.
<CodeHeader>BP/items/my_item.json#components</CodeHeader>
```json
"minecraft:repairable": {
"repair_items": [
{
"repair_amount": "context.other->q.remaining_durability + 0.05 * context.other->q.max_durability",
"items": [
"bs:silver",
"bs:silver_axe"
]
}
]
}
```
Formula explanation:
`"context.other->q.remaining_durability + 0.05 * context.other->q.max_durability"`
The _final_ durability will be durability of the first axe + durability of the second axe + 5% of 2nd axe MAX durability.
## on_tool_used
(This might not work now)
`on_tool_used` is special event that can be called using tags.
Tags work kinda like runtime identifiers for entities.
Known tags:
| Tag | Effects | How can be called |
| -------------------- | -------------- | -------------------------------------------------- |
| minecraft:is_axe | Strips logs | By interacting with blocks that axe interacts with |
| minecraft:is_hoe | Makes farmland | By interacting with blocks that hoe interacts with |
| minecraft:is_pickaxe | Unknown | Unknown |
| minecraft:is_sword | Unknown | Unknown |
You can apply these tags this way:
<CodeHeader>BP/items/my_item.json#components</CodeHeader>
```json
"tag:minecraft:is_axe": {}
```

View File

@@ -0,0 +1,243 @@
---
title: Troubleshooting Items
category: General
nav_order: 4
tags:
- help
mentions:
- SmokeyStack
- yanasakana
- SirLich
- MedicalJewel105
- TheDoctor15
- ThomasOrs
---
:::tip
This page contains troubleshooting information about _items_. You should read our [global troubleshooting](/guide/troubleshooting) document before continuing here.
:::
## Start Here
I followed a tutorial or tried to make my own item and something is wrong! Calm down. This page will help debug common issues. Follow the buttons and prompts to learn about possible issues with your item, and tips for fixing.
<BButton color="blue" link="#_1-10-vs-1-16-items">Continue</BButton>
---
## 1.10 vs 1.16 Items?
Before starting, you need to determine whether you creating an experimental item, or a stable item.
:::tip
Versions `1.16.0` and prior are currently **stable** (Includes versions `1.16`, `1.14`, `1.13`, `1.12`, `1.10`). These **do not** require `Holiday Creator Features` to be enabled.
🔗 Tutorial on [stable items](/guide/custom-item).
🔗 Documentation for [stable items](https://bedrock.dev/docs/1.16.0.0/1.16.20.54/Item)
:::
:::tip
Versions `1.16.100` and onward are **experimental**. These items **will not work unless** `Holiday Creator Features` **is enabled in the world**.
🔗 Our tutorial on [experimental items](/items/item-components).
🔗 Documentation for [experimental items](https://bedrock.dev/docs/stable/Item)
:::
### Continue
<BButton color="blue" link="#stable-items">1.10 format (stable)</BButton> <BButton color="blue" link="#experimental-items">1.16.100 format (experimental)</BButton>
---
## Stable Items
This section contains troubleshooting information for stable items. Remember, you are using the `1.10` format, so you need both an RP file and a BP file for your item! If you only have a BP file, you have become confused between format versions. Please start again [here](#_1-10-vs-1-16-items).
Find the issue you have, then read the prompts.
- [I cannot /give myself my custom item!](#i-cannot-give-myself-my-custom-item)
- [My textures are missing!](#my-textures-are-missing)
### I cannot /give myself my custom item!
An issue here will be caused by the item file in the BP.
- Confirm that your pack is actually applied to your world
- Confirm that your item is in the folder `BP/items/`
- Confirm that your item is valid, according to [jsonlint](https://jsonlint.com/).
- Confirm that your identifier is all lowercase, and looks similar to this: `wiki:my_item`
### My textures are missing!
Navigate to your `item_texture.json` file. Ensure that it is properly named, and in the correct folder. Some examples of wrong names:
- ⚠️ `texture/item_texture.json`
- ⚠️ `textures/Item_texture.json`
- ⚠️ `textures/item_textures.json`
Here is an example file to compare against:
<CodeHeader>RP/textures/item_texture.json</CodeHeader>
```json
{
"resource_pack_name": "wiki",
"texture_name": "atlas.items",
"texture_data": {
"gem": {
"textures": "textures/items/gem"
}
}
}
```
Next, navigate to your items RP file. Ensure that it is in the correct folder. Example of incorrect path:
- ⚠️ `item/gem.json`
An example file, to compare against:
<CodeHeader>RP/items/gem.json</CodeHeader>
```json
{
"format_version": "1.10",
"minecraft:item": {
"description": {
"identifier": "wiki:gem",
"category": "Nature"
},
"components": {
"minecraft:icon": "gem", //make sure this string matches the string you put in item_texture.json!
"minecraft:render_offsets": "tools"
}
}
}
```
If you followed this properly, your item should now have a texture.
---
## Experimental Items
This section contains troubleshooting information for experimental items. Remember, you are using the `1.16` format, so there shouldn't be an RP file for your item! If you have both an RP file and a BP file, you have become confused between format versions. Please start again [here](#_1-10-vs-1-16-items).
Find the issue you have, then read the prompts.
- [Start Here](#start-here)
- [1.10 vs 1.16 Items?](#110-vs-116-items)
- [Continue](#continue)
- [Stable Items](#stable-items)
- [I cannot /give myself my custom item!](#i-cannot-give-myself-my-custom-item)
- [My textures are missing!](#my-textures-are-missing)
- [Experimental Items](#experimental-items)
- [I cannot /give myself my custom item!](#i-cannot-give-myself-my-custom-item-1)
- [My Textures Are Missing!](#my-textures-are-missing-1)
- [My item is Huge](#my-item-is-huge)
- [What now?](#what-now)
### I cannot /give myself my custom item!
- Confirm that your pack is actually applied to your world
- Confirm that your item is in the folder `BP/items/`
- Confirm that your item is valid, according to [jsonlint](https://jsonlint.com/).
- Confirm that your identifier is all lowercase, and looks similar to this: `wiki:my_item`
### My Textures Are Missing!
Navigate to your `item_texture.json` file. Ensure that it is properly named, and in the correct folder. Some examples of wrong names:
- ⚠️ `texture/item_texture.json`
- ⚠️ `textures/Item_texture.json`
- ⚠️ `textures/item_textures.json`
Here is an example file to compare against:
<CodeHeader>RP/textures/item_texture.json</CodeHeader>
```json
{
"resource_pack_name": "wiki",
"texture_name": "atlas.items",
"texture_data": {
"gem": {
"textures": "textures/items/gem"
}
}
}
```
Next, navigate to your items BP file. Place the `minecraft:icon` component in your item file under the components section. Ensure that it is properly named.
<CodeHeader>BP/items/your_item.json</CodeHeader>
```json
{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "namespace:your_item",
"category" : "items" // This line is required
},
"components": {
"minecraft:icon": {
"texture": "your_item_name" // Make sure this string matches the string you put in item_texture.json
}
},
"events": {...}
}
}
```
If you followed this properly, your item should now have a texture.
### My item is Huge
To turn it to back into a normal size item (`16x16`), use render offsets and the following formula: `base value/(res/16)`
The base values, `[0.075, 0.125, 0.075]`, seems to be the about the same scale value as normal items.
<CodeHeader>BP/items/your_item.json#components</CodeHeader>
```json
"minecraft:render_offsets":{
"main_hand":{
"first_person":{
"scale":[
0,
0,
0
]
},
"third_person":{
"scale":[
0,
0,
0
]
}
},
"off_hand":{
"first_person":{
"scale":[
0,
0,
0
]
},
"third_person":{
"scale":[
0,
0,
0
]
}
}
}
```
## What now?
You've reached the end of the guide. If you still have any problems, feel free to [join the discord server](/discord) and ask your question there.

View File

@@ -0,0 +1,536 @@
---
title: Vanilla Usage Components
category: Documentation
mentions:
- MedicalJewel105
---
This page was created with [Wiki Content Generator](https://github.com/Bedrock-OSS/bedrock-wiki-content-generator). If there are issues, contact us on [Bedrock OSS](https://discord.gg/XjV87YN) Discord server.
Note that not more than 8 examples are shown for each component to keep this page fast to load. Namespace `minecraft` was also removed.
If you want to see full page, you can do it [here](/items/vui-full). *Last updated for 1.20.10*
## block
<Spoiler title="Show">
camera
<CodeHeader></CodeHeader>
```json
"minecraft:block": "minecraft:camera"
```
</Spoiler>
## camera
<Spoiler title="Show">
camera
<CodeHeader></CodeHeader>
```json
"minecraft:camera": {
"black_bars_duration": 0.2,
"black_bars_screen_ratio": 0.08,
"shutter_duration": 0.2,
"picture_duration": 1.0,
"slide_away_duration": 0.2
}
```
</Spoiler>
## foil
<Spoiler title="Show">
appleEnchanted
<CodeHeader></CodeHeader>
```json
"minecraft:foil": true
```
golden_apple
<CodeHeader></CodeHeader>
```json
"minecraft:foil": false
```
</Spoiler>
## food
<Spoiler title="Show">
apple
<CodeHeader></CodeHeader>
```json
"minecraft:food": {
"nutrition": 4,
"saturation_modifier": "low"
}
```
appleEnchanted
<CodeHeader></CodeHeader>
```json
"minecraft:food": {
"nutrition": 4,
"saturation_modifier": "supernatural",
"can_always_eat": true,
"effects": [
{
"name": "regeneration",
"chance": 1.0,
"duration": 30,
"amplifier": 4
},
{
"name": "absorption",
"chance": 1.0,
"duration": 120,
"amplifier": 3
},
{
"name": "resistance",
"chance": 1.0,
"duration": 300,
"amplifier": 0
},
{
"name": "fire_resistance",
"chance": 1.0,
"duration": 300,
"amplifier": 0
}
]
}
```
baked_potato
<CodeHeader></CodeHeader>
```json
"minecraft:food": {
"nutrition": 5,
"saturation_modifier": "normal"
}
```
beef
<CodeHeader></CodeHeader>
```json
"minecraft:food": {
"nutrition": 3,
"saturation_modifier": "low"
}
```
beetroot
<CodeHeader></CodeHeader>
```json
"minecraft:food": {
"nutrition": 1,
"saturation_modifier": "normal"
}
```
beetroot_soup
<CodeHeader></CodeHeader>
```json
"minecraft:food": {
"nutrition": 6,
"saturation_modifier": "normal",
"using_converts_to": "bowl"
}
```
bread
<CodeHeader></CodeHeader>
```json
"minecraft:food": {
"nutrition": 5,
"saturation_modifier": "normal"
}
```
carrot
<CodeHeader></CodeHeader>
```json
"minecraft:food": {
"nutrition": 3,
"saturation_modifier": "normal"
}
```
</Spoiler>
## hand_equipped
<Spoiler title="Show">
appleEnchanted
<CodeHeader></CodeHeader>
```json
"minecraft:hand_equipped": false
```
</Spoiler>
## max_damage
<Spoiler title="Show">
clownfish
<CodeHeader></CodeHeader>
```json
"minecraft:max_damage": 0
```
cooked_fish
<CodeHeader></CodeHeader>
```json
"minecraft:max_damage": 0
```
cooked_salmon
<CodeHeader></CodeHeader>
```json
"minecraft:max_damage": 0
```
fish
<CodeHeader></CodeHeader>
```json
"minecraft:max_damage": 0
```
pufferfish
<CodeHeader></CodeHeader>
```json
"minecraft:max_damage": 0
```
salmon
<CodeHeader></CodeHeader>
```json
"minecraft:max_damage": 0
```
</Spoiler>
## max_stack_size
<Spoiler title="Show">
beetroot_soup
<CodeHeader></CodeHeader>
```json
"minecraft:max_stack_size": 1
```
honey_bottle
<CodeHeader></CodeHeader>
```json
"minecraft:max_stack_size": 16
```
mushroom_stew
<CodeHeader></CodeHeader>
```json
"minecraft:max_stack_size": 1
```
rabbit_stew
<CodeHeader></CodeHeader>
```json
"minecraft:max_stack_size": 1
```
suspicious_stew
<CodeHeader></CodeHeader>
```json
"minecraft:max_stack_size": 1
```
</Spoiler>
## seed
<Spoiler title="Show">
beetroot_seeds
<CodeHeader></CodeHeader>
```json
"minecraft:seed": {
"crop_result": "beetroot"
}
```
carrot
<CodeHeader></CodeHeader>
```json
"minecraft:seed": {
"crop_result": "carrots"
}
```
glow_berries
<CodeHeader></CodeHeader>
```json
"minecraft:seed": {
"crop_result": "cave_vines",
"plant_at": [
"cave_vines",
"cave_vines_head_with_berries"
],
"plant_at_any_solid_surface": true,
"plant_at_face": "DOWN"
}
```
melon_seeds
<CodeHeader></CodeHeader>
```json
"minecraft:seed": {
"crop_result": "melon_stem"
}
```
nether_wart
<CodeHeader></CodeHeader>
```json
"minecraft:seed": {
"plant_at": "soul_sand",
"crop_result": "nether_wart"
}
```
pitcher_pod
<CodeHeader></CodeHeader>
```json
"minecraft:seed": {
"crop_result": "pitcher_crop"
}
```
potato
<CodeHeader></CodeHeader>
```json
"minecraft:seed": {
"crop_result": "potatoes"
}
```
pumpkin_seeds
<CodeHeader></CodeHeader>
```json
"minecraft:seed": {
"crop_result": "pumpkin_stem"
}
```
</Spoiler>
## stacked_by_data
<Spoiler title="Show">
appleEnchanted
<CodeHeader></CodeHeader>
```json
"minecraft:stacked_by_data": true
```
clownfish
<CodeHeader></CodeHeader>
```json
"minecraft:stacked_by_data": true
```
cooked_fish
<CodeHeader></CodeHeader>
```json
"minecraft:stacked_by_data": true
```
cooked_salmon
<CodeHeader></CodeHeader>
```json
"minecraft:stacked_by_data": true
```
fish
<CodeHeader></CodeHeader>
```json
"minecraft:stacked_by_data": true
```
golden_apple
<CodeHeader></CodeHeader>
```json
"minecraft:stacked_by_data": true
```
pufferfish
<CodeHeader></CodeHeader>
```json
"minecraft:stacked_by_data": true
```
salmon
<CodeHeader></CodeHeader>
```json
"minecraft:stacked_by_data": true
```
</Spoiler>
## use_duration
<Spoiler title="Show">
apple
<CodeHeader></CodeHeader>
```json
"minecraft:use_duration": 32
```
appleEnchanted
<CodeHeader></CodeHeader>
```json
"minecraft:use_duration": 32
```
baked_potato
<CodeHeader></CodeHeader>
```json
"minecraft:use_duration": 32
```
beef
<CodeHeader></CodeHeader>
```json
"minecraft:use_duration": 32
```
beetroot
<CodeHeader></CodeHeader>
```json
"minecraft:use_duration": 32
```
beetroot_soup
<CodeHeader></CodeHeader>
```json
"minecraft:use_duration": 32
```
bread
<CodeHeader></CodeHeader>
```json
"minecraft:use_duration": 32
```
camera
<CodeHeader></CodeHeader>
```json
"minecraft:use_duration": 100000
```
</Spoiler>

1005
docs/wiki/items/vui-full.md Normal file

File diff suppressed because it is too large Load Diff