You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -15,7 +15,7 @@ In this guide we will create a custom edible item which can mine sand instantly
15
15
## How do custom items work?
16
16
Custom items are items with a unique set of item components to change their appearance and functionality. As of 1.21, we cannot create fully custom items - instead, we need to take an item which exists, and add, remove, or edit their item components to customise it.
17
17
18
-
Item components cannot cover every desired functionality. An example of this is doing something when the item is right clicked. We still have to use workarounds for this, such as giving the item a `food` component to make it edible, then detecting when a player starts eating it. You can read more about this in our [right click detection](/guide/right-click) guide.
18
+
Item components cannot cover every desired functionality. An example of this is doing something when the item is right clicked. We still have to use workarounds for this, such as giving the item a `food` component to make it edible, then detecting when a player starts eating it. You can read more about this in our [right click detection](/guide/right-click) summary.
19
19
20
20
## Creating our custom item
21
21
We are going to create a custom item with the following properties:
@@ -32,13 +32,14 @@ These are all the item components which we are going to use.
32
32
| Property | Component needed | Our component |
33
33
| - | - | - |
34
34
| Mines sand very quickly | `minecraft:tool` is used to make items mine different blocks quickly | `[tool={default_mining_speed:1.5,damage_per_block:0,rules:[{blocks:"minecraft:sand",speed:100}]}]` |
35
-
| Is edible, makes the player glow | `minecraft:food` makes items edible. We can also use it to specify an effect for the player to recieve. | `[food={nutrition:3,saturation:1,can_always_eat:true,effects:[{id:"minecraft:glowing",duration:100}]}]` |
35
+
| Is edible, makes the player glow | `minecraft:consumable` makes items edible. We can also use it to specify an effect for the player to recieve. | `[consumable={on_consume_effects:[{type:"minecraft:apply_effects",effects:[{id:"minecraft:glowing",amplifier:1,duration:100}]}]}]` |
36
+
| Gives the player saturation and nutrition stats on consumption | `minecraft:food` gives the player saturation and nutrition after consuming it. | `[food={nutrition:3,saturation:1,can_always_eat:true}]` |
36
37
| Is called Sandy McDesertface | `minecraft:item_name` overrides our item name. | `[item_name="Sandy McDesertface"]` |
37
38
38
39
Combining all of these together, we can create a give command for our custom item:
`minecraft:stick` can be any item you want. All custom items need to be based on an existing item. We do not yet have the functionality to create our own item IDs. However, we can make use of the `custom_model_data` (or `custom_model` in recent snapshots) component to change the model or texture of the item.
Copy file name to clipboardExpand all lines: src/routes/guide/adding-new-features/smithing-trims/+page.svx
+16-10Lines changed: 16 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Adding Smithing Trims
3
3
description: "Learn how to add custom smithing trims patterns to Minecraft just with a datapack and a resourcepack!"
4
-
version: 1.21.4
4
+
version: 1.21.5
5
5
---
6
6
7
7
# How to add custom Smithing Trims
@@ -28,15 +28,14 @@ going to call it `example_pattern.json`. Inside, we will put and configure these
28
28
{
29
29
"asset_id": "<namespace>:example_template",
30
30
"description": "Example Trim",
31
-
"template_item": "minecraft:diamond_block",
32
31
"decal": false
33
32
}
34
33
```
35
34
36
35
This is a run-down of the fields in that file:
37
36
- `description`: A text component to use as this trim's description name.
38
-
- `template_item`: The item that represents the template item (E.g. the bolt armor trim used the `bolt_armor_trim_smithing_template` item).
39
37
- `asset_id`: The resource location which is used in the resourcepack.
38
+
- `decal`: Whether or not the pattern texture should be masked based on the underlying armor. Optional, defaults to false.
40
39
41
40
If you are not sure what to put in `asset_id`, don't worry, the resource pack part is going to focus on that!
42
41
@@ -47,10 +46,13 @@ Now, we are going to add the recipe file into `data/<namespace>/recipe/`. You ca
47
46
"type": "minecraft:smithing_trim",
48
47
"addition": "#minecraft:trim_materials",
49
48
"base": "#minecraft:trimmable_armor",
50
-
"template": "minecraft:diamond_block"
49
+
"template": "minecraft:diamond_block",
50
+
"pattern": "<namespace>:example_template"
51
51
}
52
52
```
53
53
54
+
Here we have to specify the template item which is going to be used for the pattern, and the trim pattern ID itself.
55
+
54
56
### Finishing up with the resourcepack - Smithing Trim Pattern
55
57
56
58
To finish off, we'll need to add the actual definition for all the different colors and armor types. This can be done by changing the armor trim's atlas file. This file can be found in `assets/minecraft/atlases/armor_trims.json`. Please note that the exact spelling and the use of the Minecraft namespace is required here!
@@ -104,8 +106,8 @@ in-game. You will also need to leave and rejoin the world to update the datapack
104
106
For this to work, you will need to leave and rejoin the world, just using the `/reload` command won't do the trick here!
105
107
:::
106
108
107
-
## Adding a smithing trim color palette
108
-
### Setting up the datapack - Smithing Trim Color Palette
109
+
## Adding a smithing trim material
110
+
### Setting up the datapack - Smithing Trim Material
109
111
110
112
For this example, we are going to add a new trim color palette. To start, we are going to create the main trim color palette file in the directory `data/<namespace>/trim_material/`.
111
113
Once again, you can name the file whatever you want, but it has to be in the `.json` file format. For the purposes of this tutorial, we're
@@ -117,14 +119,12 @@ going to call it `matexample.json`. Inside, we will put and configure these sett
117
119
"description": {
118
120
"text": "Example Material",
119
121
"color": "#00e09d"
120
-
},
121
-
"ingredient": "minecraft:barrier"
122
+
}
122
123
}
123
124
```
124
125
125
126
This is a run-down of the fields in that file:
126
127
- `description`: A text component to use as this trim's material description name.
127
-
- `ingredient`: The item that represents the material.
128
128
- `asset_name`: The resource location which is used in the resourcepack.
129
129
- `override_armor_materials`: A list of optional armors which should have a different color palette. (E.g. Gold trim on gold armor has a darker color palette.)
130
130
@@ -138,7 +138,13 @@ Next, we are going to add the `ingredient` item to the `#minecraft:trim_material
138
138
}
139
139
```
140
140
141
-
### Finishing up with the resourcepack - Smithing Trim Color Palette
141
+
As of 1.21.5, every item you want to work as a trim material, needs to have the [`provides_trim_material`](https://minecraft.wiki/w/Data_component_format#provides_trim_material) item component. So to give ourselfs a barrier which provides our custom trim material, we can use this `/give` command:
### Finishing up with the resourcepack - Smithing Trim Material
142
148
143
149
To finish off, we'll need to add the material definition in the resourcepack. This can be done by changing the armor trim's atlas file. This file can be found in `assets/minecraft/atlases/armor_trims.json`. Please note that the exact spelling and the use of the Minecraft namespace is required here!
description: Learn how to create a Minecraft datapack with our beginner's guide. This step-by-step tutorial will help you understand the basics of datapack creation, even if you have little coding knowledge. Start enhancing your Minecraft experience today!
5
-
version: 1.21.4
5
+
version: 1.21.5
6
6
---
7
7
8
8
<script lang="ts">
@@ -184,8 +184,8 @@ Now we've created a function which will run infinitely on a loop, we can move on
184
184
ground.
185
185
186
186
As far as the game is concerned, an arrow is an **entity**, just like a pig, cow or zombie. Minecraft gives us a special
187
-
way to **select** any types of entities with [target selectors](/concepts/target_selectors). Once we've selected an
188
-
entity, we can use the [/execute](/command/execute) command to run a command as the entity.
187
+
way to **select** any types of entities with [target selectors](/wiki/concepts/target-selectors). Once we've selected an
188
+
entity, we can use the [/execute](/wiki/command/execute) command to run a command as the entity.
189
189
190
190
We can use these to select all arrows which are in the ground, and then run a command to make them explode (and then
Copy file name to clipboardExpand all lines: src/routes/guide/mcfunction-vs-coding/+page.svx
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: MCFunction vs Coding
3
3
description: "Learn the differences between using MCFunctions and traditional coding."
4
-
version: 1.21.4
4
+
version: 1.21.5
5
5
---
6
6
7
7
# MCFunction vs Traditional Coding
@@ -15,12 +15,12 @@ trying to apply traditional coding logic to MCFunction.
15
15
16
16
MCFunction isn't like most programming languages, MCFunction uses scoreboards, storages and macros (1.20.2+) as their variables.
17
17
18
-
**Scoreboards** are like a table. They store a name and a value which you can then retrieve and modify later. You can use both entity names/UUIDs and "fake player"
18
+
[Scoreboards](/wiki/nbt-scoreboards/scoreboards) are like a table. They store a name and a value which you can then retrieve and modify later. You can use both entity names/UUIDs and "fake player"
19
19
names (names not associated with any player), allowing for easy combination of variables and entity scores. Scoreboards can only hold 32-bit integers and other data
20
20
types (such as floats, doubles or strings) can not be stored this way.
21
21
22
-
[Storages](/wiki/nbt/storages) are a way of storing [NBT data](/wiki/nbt/nbt) without attaching it to an entity or block. Storages are stored globally per
23
-
world and unlike scoreboards, don’t need to be initialized beforehand. Unlike entity and block NBT, storages have no fixed structure, and can contain whichever
22
+
[Storages](/wiki/nbt-scoreboards/nbt#nbt-storages) are a way of storing [NBT data](/wiki/nbt-scoreboards/nbt) without attaching it to an entity or block. Storages are stored globally per
23
+
world and unlike scoreboards, don't need to be initialized beforehand. Unlike entity and block NBT, storages have no fixed structure, and can contain whichever
24
24
arbitrary keys are added to it.
25
25
26
26
[Macros](/wiki/files/functions#macro-functions) are like fancy string templating, when a function is supplied with macros, it will go through the function file
@@ -62,7 +62,7 @@ data modify storage example:main other_number set from storage example:main numb
62
62
data modify storage example:main compound.array append value 42
63
63
```
64
64
65
-
(Get more info on storages on [the wiki page](/wiki/nbt/storages))
65
+
(Get more info on storages on [the wiki page](/wiki/nbt-scoreboards/nbt#nbt-storages))
Copy file name to clipboardExpand all lines: src/routes/guide/misc/raycasts/+page.svx
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Raycasts
3
3
description: "Raycasting is when we shoot a line from the player's eyes in the direction they are looking. We use this to get what the player is looking at, and do something to it, such as spawning an explosion."
4
-
version: 1.21.4
4
+
version: 1.21.5
5
5
---
6
6
7
7
# Raycasting
@@ -57,7 +57,7 @@ tag @s remove raycaster
57
57
58
58
In the raycast function, we just want to check if the function has hit an entity, and if not, run it again until it does, hits a wall, or reaches the raycasts limit, moving slightly each time.
59
59
60
-
The next step is a bit more complex. We execute a command as every entity that is not the caster and whose hitbox intersects with the current path of the raycast (using [virtual volumes](https://datapack.wiki/wiki/concepts/target_selectors#dxdydz-arguments)). The command will `return run <namespace>:hit` if the raycast hits an entity. The `return run` will stop the raycast from running further, and then will run the `hit` function as the entity it has hit.
60
+
The next step is a bit more complex. We execute a command as every entity that is not the caster and whose hitbox intersects with the current path of the raycast (using [virtual volumes](https://datapack.wiki/wiki/concepts/target-selectors#dxdydz-arguments)). The command will `return run <namespace>:hit` if the raycast hits an entity. The `return run` will stop the raycast from running further, and then will run the `hit` function as the entity it has hit.
61
61
62
62
The last command checks if the raycast hit a wall. If it does, the raycast will end. If it doesn't, it will then check
63
63
if the limit is reached, again ending if it is. Should the limit not be reached yet, it will move `0.1` blocks forward and
0 commit comments