Skip to content

Commit

Permalink
Don't bother caching node owner UUIDs for transmutation interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Jul 5, 2024
1 parent f8111d9 commit 57a4aad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
14 changes: 1 addition & 13 deletions src/main/java/gripe/_90/appliede/me/misc/EMCInterfaceLogic.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.List;
import java.util.Objects;
import java.util.UUID;

import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ private boolean isPlayerInTrackedTeam(UUID uuid) {
}

private Supplier<IKnowledgeProvider> getProviderFor(UUID uuid) {
if (uuid == null) {
return null;
}

for (var entry : providersPerTeam.entrySet()) {
if (entry.getKey().getMembers().contains(uuid)) {
return entry.getValue();
Expand Down

0 comments on commit 57a4aad

Please sign in to comment.