diff --git a/src/main/java/net/frozenblock/lib/item/api/FrozenCreativeTabs.java b/src/main/java/net/frozenblock/lib/item/api/FrozenCreativeTabs.java index 50dd41af8..78f971d08 100644 --- a/src/main/java/net/frozenblock/lib/item/api/FrozenCreativeTabs.java +++ b/src/main/java/net/frozenblock/lib/item/api/FrozenCreativeTabs.java @@ -45,8 +45,9 @@ private FrozenCreativeTabs() { } public static void add(ItemLike item, ResourceKey @NotNull ... tabs) { + if (item == null) return; for (ResourceKey tab : tabs) { - ItemGroupEvents.modifyEntriesEvent(tab).register((entries) -> { + ItemGroupEvents.modifyEntriesEvent(tab).register(entries -> { var stack = new ItemStack(item); stack.setCount(1); entries.accept(stack); @@ -67,11 +68,12 @@ public static void addBefore(ItemLike comparedItem, ItemLike item, ResourceKey @NotNull ... tabs) { + if (comparedItem == null || item == null) return; for (ResourceKey tab : tabs) { var stack = new ItemStack(item); stack.setCount(1); List list = List.of(stack); - ItemGroupEvents.modifyEntriesEvent(tab).register((entries) -> entries.addBefore(comparedItem, list, tabVisibility)); + ItemGroupEvents.modifyEntriesEvent(tab).register(entries -> entries.addBefore(comparedItem, list, tabVisibility)); } } @@ -80,6 +82,7 @@ public static void addBefore(ItemLike comparedItem, ItemLike item, CreativeModeT * @param item The item that is going to be added */ public static void addBefore(ItemLike comparedItem, ItemLike item, String path, CreativeModeTab.TabVisibility tabVisibility, ResourceKey @NotNull ... tabs) { + if (comparedItem == null || item == null) return; for (ResourceKey tab : tabs) { var stack = new ItemStack(item); stack.setCount(1); @@ -104,6 +107,7 @@ public static void addAfter(ItemLike comparedItem, ItemLike item, ResourceKey @NotNull ... tabs) { + if (comparedItem == null || item == null) return; for (ResourceKey tab : tabs) { var stack = new ItemStack(item); stack.setCount(1); @@ -117,6 +121,7 @@ public static void addAfter(ItemLike comparedItem, ItemLike item, CreativeModeTa * @param item The item that is going to be added */ public static void addAfter(ItemLike comparedItem, ItemLike item, String path, CreativeModeTab.TabVisibility tabVisibility, ResourceKey @NotNull ... tabs) { + if (comparedItem == null || item == null) return; for (ResourceKey tab : tabs) { var stack = new ItemStack(item); stack.setCount(1); @@ -129,6 +134,7 @@ public static void addAfter(ItemLike comparedItem, ItemLike item, String path, C } public static void addInstrument(Item instrument, TagKey tagKey, CreativeModeTab.TabVisibility tabVisibility, ResourceKey @NotNull ... tabs) { + if (instrument == null) return; for (ResourceKey tab : tabs) { ItemGroupEvents.modifyEntriesEvent(tab).register((entries) -> { for (Holder holder : BuiltInRegistries.INSTRUMENT.getTagOrEmpty(tagKey)) { @@ -144,9 +150,10 @@ public static void addInstrument(Item instrument, TagKey tagKey, Cre * @param comparedItem The item that the added item is compared to * @param instrument The instrument that is going to be added */ - public static void addInstrumentBefore(Item comparedItem, Item instrument, TagKey tagKey, CreativeModeTab.TabVisibility tabVisibility, ResourceKey @NotNull ... tabs) { + public static void addInstrumentBefore(ItemLike comparedItem, Item instrument, TagKey tagKey, CreativeModeTab.TabVisibility tabVisibility, ResourceKey @NotNull ... tabs) { + if (comparedItem == null || instrument == null) return; for (ResourceKey tab : tabs) { - ItemGroupEvents.modifyEntriesEvent(tab).register((entries) -> { + ItemGroupEvents.modifyEntriesEvent(tab).register(entries -> { List list = new ArrayList<>(); for (Holder holder : BuiltInRegistries.INSTRUMENT.getTagOrEmpty(tagKey)) { var stack = InstrumentItem.create(instrument, holder); @@ -163,6 +170,7 @@ public static void addInstrumentBefore(Item comparedItem, Item instrument, TagKe * @param instrument The instrument that is going to be added */ public static void addInstrumentAfter(Item comparedItem, Item instrument, TagKey tagKey, CreativeModeTab.TabVisibility tabVisibility, ResourceKey @NotNull ... tabs) { + if (comparedItem == null || instrument == null) return; for (ResourceKey tab : tabs) { ItemGroupEvents.modifyEntriesEvent(tab).register((entries) -> { List list = new ArrayList<>();