Skip to content

Commit

Permalink
basic 2 items
Browse files Browse the repository at this point in the history
DylM0nster22 committed Nov 3, 2024
1 parent 0a998bd commit 455c27a
Showing 8 changed files with 59 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/net/dylan/magicmod/MagicMod.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.dylan.magicmod;

import net.dylan.magicmod.item.ModItems;
import net.fabricmc.api.ModInitializer;

import org.slf4j.Logger;
@@ -11,6 +12,6 @@ public class MagicMod implements ModInitializer {

@Override
public void onInitialize() {

ModItems.registerModItems();
}
}
11 changes: 11 additions & 0 deletions src/main/java/net/dylan/magicmod/block/ModBlocks.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package net.dylan.magicmod.block;

import net.dylan.magicmod.MagicMod;

public class ModBlocks {

public static void registerModBlocks() {
MagicMod.LOGGER.info("Registering Blocks for " + MagicMod.MOD_ID);

}
}
30 changes: 30 additions & 0 deletions src/main/java/net/dylan/magicmod/item/ModItems.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package net.dylan.magicmod.item;

import net.dylan.magicmod.MagicMod;
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.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;

public class ModItems {
public static Item MAGIC_SWORD = registerItem("magic_sword", new Item(new Item.Settings()));
public static Item MAGIC_CRYSTAL = registerItem("magic_crystal", new Item(new Item.Settings()));

private static Item registerItem(String name, Item item) {
return Registry.register(Registries.ITEM, Identifier.of(MagicMod.MOD_ID, name), item);
}

public static void registerModItems() {
MagicMod.LOGGER.info("Registering Items for " + MagicMod.MOD_ID);

ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register(entries -> {
entries.add(MAGIC_SWORD);
});
ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(entries -> {
entries.add(MAGIC_CRYSTAL);
});
}
}
4 changes: 4 additions & 0 deletions src/main/resources/assets/magicmod/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"item.magicmod.magic_sword": "Magic Sword",
"item.magicmod.magic_crystal": "Magic Crystal"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0":"magicmod:item/magic_crystal"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0":"magicmod:item/magic_sword"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 455c27a

Please sign in to comment.