package com.r3944realms.leashedplayer.content.items; import com.r3944realms.leashedplayer.LeashedPlayer; import com.r3944realms.leashedplayer.content.items.type.LeashRopeArrowItem; import com.r3944realms.leashedplayer.content.items.type.SpectralLeashRopeArrowItem; import com.r3944realms.leashedplayer.content.items.type.TestItem; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.item.Item; import net.minecraft.world.item.SpectralArrowItem; import net.neoforged.bus.api.IEventBus; import net.neoforged.neoforge.registries.DeferredRegister; import java.util.ArrayList; import java.util.List; import java.util.function.Supplier; public class ModItemRegister { public static final DeferredRegister ITEMS = DeferredRegister.create(BuiltInRegistries.ITEM, LeashedPlayer.MOD_ID); public static final List> ITEM_SUPPLIER = new ArrayList<>(); public static final Supplier LEASH_ROPE_ARROW = ModItemRegister.register("leash_rope_arrow", () -> new LeashRopeArrowItem(new Item.Properties().stacksTo(16)) ); public static final Supplier SPECTRAL_LEASH_ROPE_ARROW = ModItemRegister.register("spectral_leash_rope_arrow", () -> new SpectralLeashRopeArrowItem(new Item.Properties().stacksTo(16))); public static final Supplier FABRIC = ModItemRegister.register("fabric", () -> new TestItem(new Item.Properties().stacksTo(1)) ); public static Supplier register(String name, Supplier supplier) { return register(name, supplier, true); } public static Supplier register(String name, Supplier supplier, boolean shouldJoinSupplierLists) { Supplier supplierItem = ITEMS.register(name, supplier); if(shouldJoinSupplierLists) ITEM_SUPPLIER.add(supplierItem); return supplierItem; } public static void register(IEventBus eventBus) { ITEMS.register(eventBus); } }