diff --git a/src/main/java/com/example/AdamantiteIngot.java b/src/main/java/com/example/AdamantiteIngot.java new file mode 100644 index 0000000..e346f3b --- /dev/null +++ b/src/main/java/com/example/AdamantiteIngot.java @@ -0,0 +1,22 @@ +package com.example; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.sound.SoundEvents; +import net.minecraft.util.Hand; +import net.minecraft.util.TypedActionResult; +import net.minecraft.world.World; + +public class AdamantiteIngot extends Item{ + + public AdamantiteIngot(Item.Settings settings) { + super(settings); + } + + @Override + public TypedActionResult use(World world, PlayerEntity user, Hand hand) { + user.playSound(SoundEvents.BLOCK_AMETHYST_BLOCK_CHIME, 1.0f, 1.0f); + return TypedActionResult.success(user.getStackInHand(hand)); + } +} diff --git a/src/main/java/com/example/ExampleMod.java b/src/main/java/com/example/ExampleMod.java index ba578d2..86f4ade 100644 --- a/src/main/java/com/example/ExampleMod.java +++ b/src/main/java/com/example/ExampleMod.java @@ -2,6 +2,15 @@ package com.example; import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.item.v1.FabricItemSettings; +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroups; +import net.minecraft.item.Items; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.util.Identifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -10,13 +19,15 @@ public class ExampleMod implements ModInitializer { // It is considered best practice to use your mod id as the logger's name. // That way, it's clear which mod wrote info, warnings, and errors. public static final Logger LOGGER = LoggerFactory.getLogger("examplemod"); - + public static final AdamantiteIngot ADAMANTITE_INGOT = new AdamantiteIngot(new Item.Settings()); @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!"); + Registry.register(Registries.ITEM, new Identifier("examplemod", "adamantite_ingot"), ADAMANTITE_INGOT); + ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(content -> { + content.addAfter(Items.DIAMOND, ADAMANTITE_INGOT); + }); } } \ 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 new file mode 100644 index 0000000..4826cd6 --- /dev/null +++ b/src/main/resources/assets/examplemod/lang/en_us.json @@ -0,0 +1,3 @@ +{ + "item.examplemod.adamantite_ingot": "Adamantite Ingot" +} \ No newline at end of file diff --git a/src/main/resources/assets/examplemod/models/item/adamantite_ingot.json b/src/main/resources/assets/examplemod/models/item/adamantite_ingot.json new file mode 100644 index 0000000..9d76cca --- /dev/null +++ b/src/main/resources/assets/examplemod/models/item/adamantite_ingot.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "examplemod:item/adamantite_ingot" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/examplemod/textures/item/adamantite_ingot.png b/src/main/resources/assets/examplemod/textures/item/adamantite_ingot.png new file mode 100644 index 0000000..2c06c50 Binary files /dev/null and b/src/main/resources/assets/examplemod/textures/item/adamantite_ingot.png differ