Block complete

This commit is contained in:
Prabuddha Hans 2024-07-21 19:05:57 +01:00
parent d8ea17d31d
commit 886497fcc4
6 changed files with 29 additions and 1 deletions

View file

@ -25,6 +25,9 @@ public class ExampleMod implements ModInitializer {
// Our ingredient item // Our ingredient item
public static final AdamantiteIngot ADAMANTITE_INGOT = new AdamantiteIngot(new Item.Settings()); public static final AdamantiteIngot ADAMANTITE_INGOT = new AdamantiteIngot(new Item.Settings());
// Our block
public static final Block ADAMANTITE_BLOCK = new AdamantiteBlock(Block.Settings.create().strength(1.0f).requiresTool().sounds(BlockSoundGroup.ANVIL));
@Override @Override
public void onInitialize() { public void onInitialize() {
// This code runs as soon as Minecraft is in a mod-load-ready state. // This code runs as soon as Minecraft is in a mod-load-ready state.
@ -36,5 +39,13 @@ public class ExampleMod implements ModInitializer {
ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(content -> { ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(content -> {
content.addAfter(Items.DIAMOND, ADAMANTITE_INGOT); content.addAfter(Items.DIAMOND, ADAMANTITE_INGOT);
}); });
// Registering our block
Registry.register(Registries.BLOCK, new Identifier("examplemod", "adamantite_block"), ADAMANTITE_BLOCK);
Registry.register(Registries.ITEM, new Identifier("examplemod", "adamantite_block"), new BlockItem(ADAMANTITE_BLOCK,
new FabricItemSettings()));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.BUILDING_BLOCKS).register(content -> {
content.addAfter(Items.OBSIDIAN, ADAMANTITE_BLOCK);
});
} }
} }

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "examplemod:block/adamantite_block"
}
}
}

View file

@ -1,3 +1,4 @@
{ {
"item.examplemod.adamantite_ingot": "Adamantite Ingot" "item.examplemod.adamantite_ingot": "Adamantite Ingot",
"block.examplemod.adamantite_block": "Block of Adamantite"
} }

View file

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "examplemod:block/adamantite_block"
}
}

View file

@ -0,0 +1,3 @@
{
"parent": "examplemod:block/adamantite_block"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B