From b2d3ee2cd44bff9893ec95bbdbbe00c8099409a9 Mon Sep 17 00:00:00 2001 From: vaporvee Date: Tue, 17 Sep 2024 23:18:23 +0200 Subject: [PATCH] added some stuff --- .../java/com/vaporvee/testmod/ModItems.java | 34 ++++++++++++++++ .../java/com/vaporvee/testmod/TestMod.java | 8 ++-- .../resources/assets/testmod/lang/en_us.json | 4 ++ .../testmod/models/item/crazy_item.json | 6 +++ .../assets/testmod/models/item/icon.json | 6 +++ .../testmod/textures/item/crazy_item.png | Bin 0 -> 329 bytes .../testmod/{ => textures/item}/icon.png | Bin .../data/testmod/recipe/crazy_item.json | 37 ++++++++++++++++++ src/main/resources/fabric.mod.json | 12 +++--- 9 files changed, 96 insertions(+), 11 deletions(-) create mode 100644 src/main/java/com/vaporvee/testmod/ModItems.java create mode 100644 src/main/resources/assets/testmod/lang/en_us.json create mode 100644 src/main/resources/assets/testmod/models/item/crazy_item.json create mode 100644 src/main/resources/assets/testmod/models/item/icon.json create mode 100644 src/main/resources/assets/testmod/textures/item/crazy_item.png rename src/main/resources/assets/testmod/{ => textures/item}/icon.png (100%) create mode 100644 src/main/resources/data/testmod/recipe/crazy_item.json diff --git a/src/main/java/com/vaporvee/testmod/ModItems.java b/src/main/java/com/vaporvee/testmod/ModItems.java new file mode 100644 index 0000000..7322ecf --- /dev/null +++ b/src/main/java/com/vaporvee/testmod/ModItems.java @@ -0,0 +1,34 @@ +package com.vaporvee.testmod; + +import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; +import net.minecraft.item.ItemGroups; +import net.minecraft.item.ItemStack; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.text.Text; +import net.minecraft.util.Identifier; + +public class ModItems { + public static Item register(Item item, String id) { + return Registry.register(Registries.ITEM, Identifier.of(TestMod.MOD_ID, id), item); + } + public static final Item CRAZY_ITEM = register(new Item(new Item.Settings()), "crazy_item"); + public static final Item ICON = register(new Item(new Item.Settings()), "icon"); + + public static final RegistryKey CUSTOM_ITEM_GROUP_KEY = RegistryKey.of(Registries.ITEM_GROUP.getKey(), Identifier.of(TestMod.MOD_ID,"test_items")); + public static final ItemGroup CUSTOM_ITEM_GROUP = FabricItemGroup.builder() + .icon(() -> new ItemStack(ModItems.ICON)) + .displayName(Text.translatable("itemGroup.testmod")) + .build(); + public static void initialize() { + Registry.register(Registries.ITEM_GROUP, CUSTOM_ITEM_GROUP_KEY, CUSTOM_ITEM_GROUP); + ItemGroupEvents.modifyEntriesEvent(CUSTOM_ITEM_GROUP_KEY).register(itemGroup -> { + itemGroup.add(ModItems.CRAZY_ITEM); + } + ); + } +} diff --git a/src/main/java/com/vaporvee/testmod/TestMod.java b/src/main/java/com/vaporvee/testmod/TestMod.java index dd56eae..2083a68 100644 --- a/src/main/java/com/vaporvee/testmod/TestMod.java +++ b/src/main/java/com/vaporvee/testmod/TestMod.java @@ -15,10 +15,8 @@ public class TestMod implements ModInitializer { @Override public void onInitialize() { - // This code runs as soon as Minecraft is in a mod-load-ready state. - // However, some things (like resources) may still be uninitialized. - // Proceed with mild caution. - - LOGGER.info("Hello Fabric world!"); + LOGGER.info("TestMod initializing..."); + ModItems.initialize(); + LOGGER.info("TestMod initialized!"); } } \ No newline at end of file diff --git a/src/main/resources/assets/testmod/lang/en_us.json b/src/main/resources/assets/testmod/lang/en_us.json new file mode 100644 index 0000000..a93c90c --- /dev/null +++ b/src/main/resources/assets/testmod/lang/en_us.json @@ -0,0 +1,4 @@ +{ + "item.testmod.crazy_item" : "CRAZY ITEM WOW!", + "itemGroup.testmod": "Test Mod" +} \ No newline at end of file diff --git a/src/main/resources/assets/testmod/models/item/crazy_item.json b/src/main/resources/assets/testmod/models/item/crazy_item.json new file mode 100644 index 0000000..b7f86d5 --- /dev/null +++ b/src/main/resources/assets/testmod/models/item/crazy_item.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures" : { + "layer0": "testmod:item/crazy_item" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/testmod/models/item/icon.json b/src/main/resources/assets/testmod/models/item/icon.json new file mode 100644 index 0000000..4b32052 --- /dev/null +++ b/src/main/resources/assets/testmod/models/item/icon.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures" : { + "layer0": "testmod:item/icon" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/testmod/textures/item/crazy_item.png b/src/main/resources/assets/testmod/textures/item/crazy_item.png new file mode 100644 index 0000000000000000000000000000000000000000..9575ebbc9ac4256e1dc8ea75130cc9130905948b GIT binary patch literal 329 zcmV-P0k-~$P)Px$14%?dR5(v#WS|f*QmCJSwg%WM*8K;$@ZkL>oEG7f0BMfa&1Dc05Mh{nxE`k= zSPcMa&b4i1khlBA@bC~D!_G%r8P45V#&Gt@G7R+?0_d9GeR#uQ=*Pz}Ysqe`hM*V# z(+rClWEb3ec#1(y-VDPKxB)OfgKPsi8)Wn8PbV4DVq6){Z~6phH%^+$@ci8wxOY$t z0QnoF5fpGR+hGQQT!qaQa085GqW&AHL@~I_d4n~B{A|i+4z?LagA958?iO|zfFzL( zf!PeR6(kQbXy&i#galM43a`>;P8am3Sy&2CC-EdGYA$V*wO$