Example item added (Adamantite Ingot)
This commit is contained in:
parent
f16b6596d6
commit
1598612b5d
5 changed files with 45 additions and 3 deletions
22
src/main/java/com/example/AdamantiteIngot.java
Normal file
22
src/main/java/com/example/AdamantiteIngot.java
Normal file
|
@ -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<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
||||
user.playSound(SoundEvents.BLOCK_AMETHYST_BLOCK_CHIME, 1.0f, 1.0f);
|
||||
return TypedActionResult.success(user.getStackInHand(hand));
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
3
src/main/resources/assets/examplemod/lang/en_us.json
Normal file
3
src/main/resources/assets/examplemod/lang/en_us.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"item.examplemod.adamantite_ingot": "Adamantite Ingot"
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "examplemod:item/adamantite_ingot"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 266 B |
Loading…
Reference in a new issue