tutorial:crops
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tutorial:crops [2024/08/27 04:56] – [Registering your Crop and Seed Item] add related link solidblock | tutorial:crops [2025/04/01 12:05] (current) – fix typo solidblock | ||
|---|---|---|---|
| Line 55: | Line 55: | ||
| ===== Registering your Crop and Seed Item ===== | ===== Registering your Crop and Seed Item ===== | ||
| - | Now we need to register our crop and the item to use for our seed. The seed model and class (including the static '' | + | Now we need to register our crop and the item to use for our seed. The seed model and class (including the static '' |
| <code java [enable_line_numbers=" | <code java [enable_line_numbers=" | ||
| + | // For versions before 1.21.2: | ||
| public static final CropBlock CUSTOM_CROP = register(" | public static final CropBlock CUSTOM_CROP = register(" | ||
| + | | ||
| + | // For version 1.21.2 and later: | ||
| + | public static final Block CUSTOM_CROP = register(" | ||
| </ | </ | ||
| <code java [enable_line_numbers=" | <code java [enable_line_numbers=" | ||
| + | // For version before 1.21.2: | ||
| public static final Item CUSTOM_SEEDS = register(" | public static final Item CUSTOM_SEEDS = register(" | ||
| + | | ||
| + | // For version 1.21.2 and later: | ||
| + | public static final Item CUSTOM_SEEDS = register(" | ||
| + | </ | ||
| + | |||
| + | > In the [[blocks]] tutorial, we wrote the '' | ||
| + | > <code java TutorialBlocks.java> | ||
| + | // ... | ||
| + | public static final Block CUSTOM_CROP = registerBlockOnly(" | ||
| + | | ||
| + | // ... | ||
| + | | ||
| + | private static Block registerBlockOnly(String path, Function< | ||
| + | final Identifier identifier = Identifier.of(" | ||
| + | final RegistryKey< | ||
| + | |||
| + | return Blocks.register(registryKey, | ||
| + | } | ||
| </ | </ | ||
| Line 92: | Line 115: | ||
| </ | </ | ||
| - | Lastly you will want to create a blockstate | + | Lastly you will want to create a blockstates definition |
| <code JavaScript src/ | <code JavaScript src/ | ||
| Line 124: | Line 147: | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | > The seeds item also need a corresponding item model and item models definition (for version 1.21.4 an later), which will not be explained in length here. | ||
| ===== Loot Table ===== | ===== Loot Table ===== | ||
tutorial/crops.1724734579.txt.gz · Last modified: 2024/08/27 04:56 by solidblock