tutorial:blockentity
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:blockentity [2024/10/27 14:21] – [Registering block and block entities] solidblock | tutorial:blockentity [2025/04/01 12:20] (current) – [Block entity ticking] solidblock | ||
---|---|---|---|
Line 29: | Line 29: | ||
[...] | [...] | ||
| | ||
- | public static final DemoBlock DEMO_BLOCK = register(" | + | |
+ | // public static final DemoBlock DEMO_BLOCK = register(" | ||
+ | |||
+ | // For version 1.21.2 and later | ||
+ | public static final DemoBlock DEMO_BLOCK = register(" | ||
| | ||
[...] | [...] | ||
Line 43: | Line 47: | ||
public static final BlockEntityType< | public static final BlockEntityType< | ||
" | " | ||
- | // For versions 1.21.2 | + | // For versions |
- | // replace `BlockEntityType.Builder` with `FabricBlockEntityTypeBuilder`. | + | |
- | | + | |
); | ); | ||
| | ||
Line 70: | Line 73: | ||
For old versions, if you cannot access '' | For old versions, if you cannot access '' | ||
- | The block entity type defines that only the '' | + | The block entity type defines that only the '' |
> **Note:** Like other blocks, the block also needs a block model and an item model, and may also need a loot table, see [[blocks]] for how to create them. As for loot tables, [[blockentity_sync_itemstack|subsequent tutorials]] will cover how to improve the loot tables to include block entity data. | > **Note:** Like other blocks, the block also needs a block model and an item model, and may also need a loot table, see [[blocks]] for how to create them. As for loot tables, [[blockentity_sync_itemstack|subsequent tutorials]] will cover how to improve the loot tables to include block entity data. | ||
Line 120: | Line 123: | ||
And in your '' | And in your '' | ||
<code java DemoBlockEntity.java> | <code java DemoBlockEntity.java> | ||
- | public class DemoBlockEntity extends BlockEntity { | + | public class DemoBlockEntity extends BlockEntity |
[...] | [...] | ||
| |
tutorial/blockentity.1730038915.txt.gz · Last modified: 2024/10/27 14:21 by solidblock