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 0000000..9575ebb Binary files /dev/null and b/src/main/resources/assets/testmod/textures/item/crazy_item.png differ diff --git a/src/main/resources/assets/testmod/icon.png b/src/main/resources/assets/testmod/textures/item/icon.png similarity index 100% rename from src/main/resources/assets/testmod/icon.png rename to src/main/resources/assets/testmod/textures/item/icon.png diff --git a/src/main/resources/data/testmod/recipe/crazy_item.json b/src/main/resources/data/testmod/recipe/crazy_item.json new file mode 100644 index 0000000..458e441 --- /dev/null +++ b/src/main/resources/data/testmod/recipe/crazy_item.json @@ -0,0 +1,37 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "minecraft:amethyst_shard" + }, + { + "item": "minecraft:glowstone_dust" + }, + { + "item": "minecraft:amethyst_shard" + }, + { + "item": "minecraft:glowstone_dust" + }, + { + "item": "minecraft:redstone" + }, + { + "item": "minecraft:glowstone_dust" + }, + { + "item": "minecraft:amethyst_shard" + }, + { + "item": "minecraft:glowstone_dust" + }, + { + "item": "minecraft:amethyst_shard" + } + ], + "result": { + "id": "testmod:crazy_item", + "count": 16 + }, + "group": "stuff" +} \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 23ca6a6..f59fa95 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -2,17 +2,17 @@ "schemaVersion": 1, "id": "testmod", "version": "${version}", - "name": "TestMod", - "description": "This is an example description! Tell everyone what your mod is about!", + "name": "Test Mod", + "description": "My first Mod!", "authors": [ - "Me!" + "vaporvee" ], "contact": { - "homepage": "https://fabricmc.net/", - "sources": "https://github.com/FabricMC/fabric-example-mod" + "homepage": "https://vaporvee.com", + "sources": "https://github.com/vaporvee/TestMod" }, "license": "CC0-1.0", - "icon": "assets/testmod/icon.png", + "icon": "assets/testmod/textures/item/icon.png", "environment": "*", "entrypoints": { "main": [