Skip to content

Instantly share code, notes, and snippets.

@Kaupenjoe
Created June 18, 2021 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kaupenjoe/226977a0d7ec714d44fd57d38695b87d to your computer and use it in GitHub Desktop.
Save Kaupenjoe/226977a0d7ec714d44fd57d38695b87d to your computer and use it in GitHub Desktop.
"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