tutorial:blocks
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
tutorial:blocks [2023/10/23 09:29] – Fix typo mattidragon | tutorial:blocks [2023/11/18 08:26] – solidblock | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Adding a Block ====== | ====== Adding a Block ====== | ||
- | Adding blocks to your mod follows a similar process to [[tutorial: | + | Adding blocks to your mod follows a similar process to [[tutorial: |
===== Creating a Block ===== | ===== Creating a Block ===== | ||
Line 47: | Line 47: | ||
</ | </ | ||
- | Your custom block will //not// be accessible as an item yet, but it can be seen in-game by using the command ''/ | + | Your custom block will //not// be accessible as an item yet, but it can be seen in-game by using the command ''/ |
==== Registering an Item for your Block ==== | ==== Registering an Item for your Block ==== | ||
Line 77: | Line 77: | ||
The files should be located here: | The files should be located here: | ||
- | Blockstate: src/ | + | |
- | Block Model: src/ | + | |
- | Item Model: src/ | + | |
- | Block Texture: src/ | + | |
The blockstate file determines which model a block should use depending on its blockstate. Our block doesn' | The blockstate file determines which model a block should use depending on its blockstate. Our block doesn' | ||
Line 138: | Line 138: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | The condition '' | ||
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 level: src/ | + | * Harvest level: |
<code JavaScript src/ | <code JavaScript src/ | ||
Line 162: | Line 164: | ||
</ | </ | ||
- | For the harvest level tags (needs_stone_tool, | + | For the harvest level tags ('' |
<code java [enable_line_numbers=" | <code java [enable_line_numbers=" | ||
Line 195: | Line 196: | ||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { | public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { | ||
if (!world.isClient) { | if (!world.isClient) { | ||
- | player.sendMessage(Text.of(" | + | player.sendMessage(Text.literal(" |
} | } | ||
tutorial/blocks.txt · Last modified: 2024/04/15 01:52 by solidblock