package so.ff.ee.items; import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemGroups; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryKeys; import net.minecraft.util.Identifier; import so.ff.ee.Pourover; import java.util.function.Function; public class PouroverItems { public static final Item RawClayMug = register("raw_clay_mug", Item::new, new Item.Settings()); public static final Item RawCoffeeBeans = register("raw_coffee_beans", Item::new, new Item.Settings()); public static final Item RoastedCoffeeBeans = register("roasted_coffee_beans", Item::new, new Item.Settings()); public static final Item GroundCoffee = register("ground_coffee", Item::new, new Item.Settings()); public static final Item UsedCoffeeGrounds = register("used_coffee_grounds", Item::new, new Item.Settings()); public static Item register(String name, Function itemFactory, Item.Settings settings) { // Create the item key. RegistryKey itemKey = RegistryKey.of(RegistryKeys.ITEM, Identifier.of(Pourover.MOD_ID, name)); // Create the item instance. Item item = itemFactory.apply(settings.registryKey(itemKey)); // Register the item. Registry.register(Registries.ITEM, itemKey, item); return item; } public static void init() { ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register((itemGroup) -> { itemGroup.add(PouroverItems.RawClayMug); itemGroup.add(PouroverItems.RawCoffeeBeans); itemGroup.add(PouroverItems.RoastedCoffeeBeans); itemGroup.add(PouroverItems.GroundCoffee); }); // ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register((itemGroup) -> { // itemGroup.add(Items.ClayMug); // itemGroup.add(Items.GlassServingPot); // }); } }