Skip to content

Commit

Permalink
Dont invoke ItemGroupEvents.MODIFY_ENTRIES_ALL for the OP tab, when t…
Browse files Browse the repository at this point in the history
…he OP tab is disabled (FabricMC#4045)

(cherry picked from commit 3fc0e55)
  • Loading branch information
AshyBoxy authored and modmuss50 committed Aug 26, 2024
1 parent 024d2db commit ca1fb63
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<ItemGroupEvents.ModifyEntries> modifyEntriesEvent = ItemGroupEventsImpl.getModifyEntriesEvent(registryKey);
// Now trigger the events
if (registryKey != ItemGroups.OPERATOR || context.hasPermissions()) {
final Event<ItemGroupEvents.ModifyEntries> 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);
}

Expand Down

0 comments on commit ca1fb63

Please sign in to comment.