From 57a4aad0b2f0859283f483a87c8e5b3caecfdde7 Mon Sep 17 00:00:00 2001 From: 90 Date: Fri, 5 Jul 2024 01:05:59 +0100 Subject: [PATCH] Don't bother caching node owner UUIDs for transmutation interfaces --- .../_90/appliede/me/misc/EMCInterfaceLogic.java | 14 +------------- .../appliede/me/service/TeamProjectEHandler.java | 4 ++++ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/main/java/gripe/_90/appliede/me/misc/EMCInterfaceLogic.java b/src/main/java/gripe/_90/appliede/me/misc/EMCInterfaceLogic.java index 061bf93..0663457 100644 --- a/src/main/java/gripe/_90/appliede/me/misc/EMCInterfaceLogic.java +++ b/src/main/java/gripe/_90/appliede/me/misc/EMCInterfaceLogic.java @@ -2,7 +2,6 @@ import java.util.List; import java.util.Objects; -import java.util.UUID; import org.jetbrains.annotations.Nullable; @@ -62,7 +61,6 @@ public class EMCInterfaceLogic implements IActionHost, IGridTickable, IUpgradeab private WrappedEMCStorage emcStorage; private boolean hasConfig; - private UUID ownerUUID; public EMCInterfaceLogic(IManagedGridNode node, EMCInterfaceLogicHost host, Item is) { this(node, host, is, 9); @@ -118,21 +116,11 @@ private boolean storageFilter(AEKey what) { return true; } - if (ownerUUID == null) { - var uuid = node.getOwningPlayerProfileId(); - - if (uuid == null) { - return false; - } - - ownerUUID = uuid; - } - var knowledge = grid.getService(KnowledgeService.class); return knowledge.getKnownItems().contains(item) || (isUpgradedWith(AppliedE.LEARNING_CARD.get()) && IEMCProxy.INSTANCE.hasValue(item.toStack()) - && knowledge.getProviderFor(ownerUUID) != null); + && knowledge.getProviderFor(node.getOwningPlayerProfileId()) != null); } public void readFromNBT(CompoundTag tag) { diff --git a/src/main/java/gripe/_90/appliede/me/service/TeamProjectEHandler.java b/src/main/java/gripe/_90/appliede/me/service/TeamProjectEHandler.java index 7af73b3..aacb753 100644 --- a/src/main/java/gripe/_90/appliede/me/service/TeamProjectEHandler.java +++ b/src/main/java/gripe/_90/appliede/me/service/TeamProjectEHandler.java @@ -45,6 +45,10 @@ private boolean isPlayerInTrackedTeam(UUID uuid) { } private Supplier getProviderFor(UUID uuid) { + if (uuid == null) { + return null; + } + for (var entry : providersPerTeam.entrySet()) { if (entry.getKey().getMembers().contains(uuid)) { return entry.getValue();