Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
"block.tutorialmod.amethyst_ore": "Amethyst Ore",
ModBlocks.register(eventBus);
{
"variants": {
"": { "model": "tutorialmod:block/amethyst_ore" }
}
}
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "tutorialmod:amethyst"
}
]
}
]
}
public class ModBlocks {
public static final DeferredRegister<Block> BLOCKS
= DeferredRegister.create(ForgeRegistries.BLOCKS, TutorialMod.MOD_ID);
public static final RegistryObject<Block> AMETHYST_ORE = registerBlock("amethyst_ore",
() -> new Block(AbstractBlock.Properties.create(Material.ROCK)
.harvestLevel(2).setRequiresTool().harvestTool(ToolType.PICKAXE).hardnessAndResistance(5f)));
private static <T extends Block>RegistryObject<T> registerBlock(String name, Supplier<T> block) {
RegistryObject<T> toReturn = BLOCKS.register(name, block);
registerBlockItem(name, toReturn);
return toReturn;
}
private static <T extends Block> void registerBlockItem(String name, RegistryObject<T> block) {
ModItems.ITEMS.register(name, () -> new BlockItem(block.get(),
new Item.Properties().group(ModItemGroup.TUTORIAL_GROUP)));
}
public static void register(IEventBus eventBus) {
BLOCKS.register(eventBus);
}
}
{
"parent": "block/cube_all",
"textures": {
"all": "tutorialmod:block/amethyst_ore"
}
}
{
"parent": "tutorialmod:block/amethyst_ore"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment