tutorial:blocks
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:blocks [2024/06/13 08:12] – update parameters needed for onUse s1lverposting | tutorial:blocks [2024/06/21 21:37] – [Custom Shape] ryhon | ||
---|---|---|---|
Line 52: | Line 52: | ||
@Override | @Override | ||
public void onInitialize() { | public void onInitialize() { | ||
- | Registry.register(Registries.BLOCK, | + | |
+ | // Registry.register(Registries.BLOCK, | ||
+ | // For versions since 1.21: | ||
+ | Registry.register(Registries.BLOCK, | ||
} | } | ||
} | } | ||
Line 78: | Line 81: | ||
// For versions below 1.20.5: | // For versions below 1.20.5: | ||
// Registry.register(Registries.ITEM, | // Registry.register(Registries.ITEM, | ||
- | // For versions | + | // For versions |
- | Registry.register(Registries.ITEM, | + | |
+ | // For versions since 1.21: | ||
+ | Registry.register(Registries.ITEM, | ||
} | } | ||
} | } | ||
Line 134: | Line 139: | ||
To make your block drop items when broken, you will need a //loot table//. The following file will cause your block to drop its respective item form when broken: | To make your block drop items when broken, you will need a //loot table//. The following file will cause your block to drop its respective item form when broken: | ||
- | <code JavaScript src/ | + | For versions since 1.21, the path is '' |
+ | |||
+ | <code JavaScript src/ | ||
{ | { | ||
" | " | ||
Line 160: | Line 167: | ||
In minecraft 1.17, there has been a change for breaking blocks. Now, to define harvest tools and harvest levels, we need to use tags. Read about tags at: [[tutorial: | In minecraft 1.17, there has been a change for breaking blocks. Now, to define harvest tools and harvest levels, we need to use tags. Read about tags at: [[tutorial: | ||
- | * Harvest tool: '' | + | * Harvest tool: '' |
- | * Harvest level: '' | + | * Harvest level: '' |
- | <code JavaScript src/ | + | <code JavaScript src/ |
{ | { | ||
" | " | ||
Line 172: | Line 179: | ||
</ | </ | ||
- | <code JavaScript src/ | + | <code JavaScript src/ |
{ | { | ||
" | " | ||
Line 231: | Line 238: | ||
@Override | @Override | ||
public void onInitialize() { | public void onInitialize() { | ||
- | Registry.register(Registries.BLOCK, | + | |
- | Registry.register(Registries.ITEM, | + | // Registry.register(Registries.BLOCK, |
+ | | ||
+ | |||
+ | // For versions since 1.21: | ||
+ | Registry.register(Registries.BLOCK, | ||
+ | Registry.register(Registries.ITEM, | ||
} | } | ||
} | } | ||
Line 261: | Line 273: | ||
* **collision shape**: the shape used to calculate collisions. When entities (including players) are moving, their collision box usually cannot intersect the collision shape of blocks. Some blocks, such as fences and walls, may have a collision shape higher than one block. Some blocks, such as flowers, have an empty collision shape. Apart from modifying '' | * **collision shape**: the shape used to calculate collisions. When entities (including players) are moving, their collision box usually cannot intersect the collision shape of blocks. Some blocks, such as fences and walls, may have a collision shape higher than one block. Some blocks, such as flowers, have an empty collision shape. Apart from modifying '' | ||
* **raycasting shape**: the shape used to calculate raycasting (the process judging which block you are pointing to). You usually do not need to specify it. | * **raycasting shape**: the shape used to calculate raycasting (the process judging which block you are pointing to). You usually do not need to specify it. | ||
- | * **camera collision shape**: the shape used to calculate the position of camera in third-party view. Glass and powder snow have an empty camera collision shape. | + | * **camera collision shape**: the shape used to calculate the position of camera in third-person |
===== Next Steps ===== | ===== Next Steps ===== |
tutorial/blocks.txt · Last modified: 2024/07/04 16:29 by mineblock11