From ca1fb63b82db29196b5dc2edb3b1213ed0b60722 Mon Sep 17 00:00:00 2001 From: AshyBoxy Date: Mon, 26 Aug 2024 12:02:11 +0100 Subject: [PATCH] Dont invoke ItemGroupEvents.MODIFY_ENTRIES_ALL for the OP tab, when the OP tab is disabled (#4045) (cherry picked from commit 3fc0e552c4aadc2f1aeb1d8e9a9da560b895e23e) --- .../fabric/mixin/itemgroup/ItemGroupMixin.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fabric-item-group-api-v1/src/main/java/net/fabricmc/fabric/mixin/itemgroup/ItemGroupMixin.java b/fabric-item-group-api-v1/src/main/java/net/fabricmc/fabric/mixin/itemgroup/ItemGroupMixin.java index b8f8b61ee0..1100781436 100644 --- a/fabric-item-group-api-v1/src/main/java/net/fabricmc/fabric/mixin/itemgroup/ItemGroupMixin.java +++ b/fabric-item-group-api-v1/src/main/java/net/fabricmc/fabric/mixin/itemgroup/ItemGroupMixin.java @@ -71,14 +71,14 @@ public void getStacks(ItemGroup.DisplayContext context, CallbackInfo ci) { var mutableSearchTabStacks = new LinkedList<>(searchTabStacks); var entries = new FabricItemGroupEntries(context, mutableDisplayStacks, mutableSearchTabStacks); - final Event modifyEntriesEvent = ItemGroupEventsImpl.getModifyEntriesEvent(registryKey); + // Now trigger the events + if (registryKey != ItemGroups.OPERATOR || context.hasPermissions()) { + final Event modifyEntriesEvent = ItemGroupEventsImpl.getModifyEntriesEvent(registryKey); - if (modifyEntriesEvent != null) { - modifyEntriesEvent.invoker().modifyEntries(entries); - } + if (modifyEntriesEvent != null) { + modifyEntriesEvent.invoker().modifyEntries(entries); + } - // Now trigger the global event - if (registryKey != ItemGroups.OPERATOR || context.hasPermissions()) { ItemGroupEvents.MODIFY_ENTRIES_ALL.invoker().modifyEntries(self, entries); }