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 [2020/06/14 00:58] – copy comments to bottom code block draylar | tutorial:blocks [2020/06/14 01:00] – fix highlighting + more comments draylar | ||
---|---|---|---|
Line 27: | Line 27: | ||
Blocks should be registered under the '' | Blocks should be registered under the '' | ||
- | <code java [enable_line_numbers=" | + | <code java [enable_line_numbers=" |
public class ExampleMod implements ModInitializer { | public class ExampleMod implements ModInitializer { | ||
Line 49: | Line 49: | ||
In most cases, you want to be able to place your block using an item. To do this, you need to register a corresponding BlockItem in the item registry. You can do this by registering an instance of BlockItem under Registry.ITEM. The registry name of the item should usually be the same as the registry name of the block. | In most cases, you want to be able to place your block using an item. To do this, you need to register a corresponding BlockItem in the item registry. You can do this by registering an instance of BlockItem under Registry.ITEM. The registry name of the item should usually be the same as the registry name of the block. | ||
- | <code java [enable_line_numbers=" | + | <code java [enable_line_numbers=" |
public class ExampleMod implements ModInitializer { | public class ExampleMod implements ModInitializer { | ||
- | // an instance of our new block | + | /* Declare and initialize |
+ | We set out block material to METAL, which requires a pickaxe to efficiently break. | ||
+ | | ||
+ | */ | ||
public static final Block EXAMPLE_BLOCK = new Block(FabricBlockSettings.of(Material.METAL)); | public static final Block EXAMPLE_BLOCK = new Block(FabricBlockSettings.of(Material.METAL)); | ||
| |
tutorial/blocks.txt · Last modified: 2024/04/15 01:52 by solidblock