From 886497fcc40cbb708390da3fdab7aa04aa2ac002 Mon Sep 17 00:00:00 2001 From: Prabuddha Hans <21313482@studentmail.ul.ie> Date: Sun, 21 Jul 2024 19:05:57 +0100 Subject: [PATCH] Block complete --- src/main/java/com/example/ExampleMod.java | 11 +++++++++++ .../examplemod/blockstates/adamantite_block.json | 7 +++++++ .../resources/assets/examplemod/lang/en_us.json | 3 ++- .../examplemod/models/block/adamantite_block.json | 6 ++++++ .../examplemod/models/item/adamantite_block.json | 3 +++ .../textures/block/adamantite_block.png | Bin 0 -> 308 bytes 6 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/assets/examplemod/blockstates/adamantite_block.json create mode 100644 src/main/resources/assets/examplemod/models/block/adamantite_block.json create mode 100644 src/main/resources/assets/examplemod/models/item/adamantite_block.json create mode 100644 src/main/resources/assets/examplemod/textures/block/adamantite_block.png diff --git a/src/main/java/com/example/ExampleMod.java b/src/main/java/com/example/ExampleMod.java index fa8798e..5a37330 100644 --- a/src/main/java/com/example/ExampleMod.java +++ b/src/main/java/com/example/ExampleMod.java @@ -25,6 +25,9 @@ public class ExampleMod implements ModInitializer { // Our ingredient item 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 public void onInitialize() { // 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 -> { 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); + }); } } \ No newline at end of file diff --git a/src/main/resources/assets/examplemod/blockstates/adamantite_block.json b/src/main/resources/assets/examplemod/blockstates/adamantite_block.json new file mode 100644 index 0000000..da8b50b --- /dev/null +++ b/src/main/resources/assets/examplemod/blockstates/adamantite_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "examplemod:block/adamantite_block" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/examplemod/lang/en_us.json b/src/main/resources/assets/examplemod/lang/en_us.json index 4826cd6..d11db4b 100644 --- a/src/main/resources/assets/examplemod/lang/en_us.json +++ b/src/main/resources/assets/examplemod/lang/en_us.json @@ -1,3 +1,4 @@ { - "item.examplemod.adamantite_ingot": "Adamantite Ingot" + "item.examplemod.adamantite_ingot": "Adamantite Ingot", + "block.examplemod.adamantite_block": "Block of Adamantite" } \ No newline at end of file diff --git a/src/main/resources/assets/examplemod/models/block/adamantite_block.json b/src/main/resources/assets/examplemod/models/block/adamantite_block.json new file mode 100644 index 0000000..fb57e12 --- /dev/null +++ b/src/main/resources/assets/examplemod/models/block/adamantite_block.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "examplemod:block/adamantite_block" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/examplemod/models/item/adamantite_block.json b/src/main/resources/assets/examplemod/models/item/adamantite_block.json new file mode 100644 index 0000000..69c0e75 --- /dev/null +++ b/src/main/resources/assets/examplemod/models/item/adamantite_block.json @@ -0,0 +1,3 @@ +{ + "parent": "examplemod:block/adamantite_block" +} \ No newline at end of file diff --git a/src/main/resources/assets/examplemod/textures/block/adamantite_block.png b/src/main/resources/assets/examplemod/textures/block/adamantite_block.png new file mode 100644 index 0000000000000000000000000000000000000000..dd65dbc3bbcfc491217859a7c29b65ce43fdbe70 GIT binary patch literal 308 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9F3${@^GvDCf{DEQ3N z#WBRfKY7iM|F7(s1qk3mPYDM-bx zVO^i#B