Skip to content

Commit

Permalink
Added Items
Browse files Browse the repository at this point in the history
  • Loading branch information
niceEli committed Feb 1, 2024
1 parent 4155eaa commit d6f3bc4
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/net/nicefilms/Simplexity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.fabricmc.api.ModInitializer;

import net.nicefilms.item.ModItems;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -12,7 +13,6 @@ public class Simplexity implements ModInitializer {

@Override
public void onInitialize() {
LOGGER.info("Hello Fabric world!");
LOGGER.info("Hello " + FriendlyModID + "!" );
ModItems.registerModItems();
}
}
37 changes: 37 additions & 0 deletions src/main/java/net/nicefilms/item/ModItems.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package net.nicefilms.item;

import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
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 net.nicefilms.Simplexity;

public class ModItems {
// Items

public static final Item RUBY = registerItem("ruby", new Item(new FabricItemSettings()));
public static final Item PHONE = registerItem("phone", new Item(new FabricItemSettings()));


private static void addItemsToIngredientTabItemGroup(FabricItemGroupEntries entries){
// You Need To Add All Your Items Here Too
entries.add(RUBY);
entries.add(PHONE);
}

// ITEM Init Functions
private static Item registerItem(String name, Item item){
return Registry.register(Registries.ITEM, new Identifier(Simplexity.ModID, name), item);
}

public static void registerModItems(){
Simplexity.LOGGER.info("Registering Mod Items for " + Simplexity.FriendlyModID);

ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(ModItems::addItemsToIngredientTabItemGroup);
}
}
4 changes: 4 additions & 0 deletions src/main/resources/assets/simplexity/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"item.simplexity.ruby": "Ruby",
"item.simplexity.phone": "iPhone"
}
6 changes: 6 additions & 0 deletions src/main/resources/assets/simplexity/models/item/phone.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "simplexity:item/phone"
}
}
6 changes: 6 additions & 0 deletions src/main/resources/assets/simplexity/models/item/ruby.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "simplexity:item/ruby"
}
}
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 d6f3bc4

Please sign in to comment.