Skip to content

Commit

Permalink
Disallow items from transmutation interface storage if the owner of t…
Browse files Browse the repository at this point in the history
…he interface isn't being tracked by the network
  • Loading branch information
62832 committed May 6, 2024
1 parent 002c1dd commit d1dc3bf
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
25 changes: 22 additions & 3 deletions src/main/java/gripe/_90/appliede/me/misc/EMCInterfaceLogic.java
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,29 @@ public boolean matches(AEKey what) {
}

var grid = mainNode.getGrid();
return grid == null
|| grid.getService(KnowledgeService.class).knowsItem(item)

if (grid == null) {
// client-side, allow everything in order for items to actually display
return true;
}

var node = mainNode.getNode();

if (node == null) {
return false;
}

var uuid = node.getOwningPlayerProfileId();

if (uuid == null) {
return false;
}

var knowledge = grid.getService(KnowledgeService.class);
return knowledge.knowsItem(item)
|| (upgrades.isInstalled(AppliedE.LEARNING_CARD.get())
&& IEMCProxy.INSTANCE.hasValue(item.toStack()));
&& IEMCProxy.INSTANCE.hasValue(item.toStack())
&& knowledge.getProviderFor(uuid) != null);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Set<IKnowledgeProvider> getProviders() {
return providers.values().stream().map(Supplier::get).collect(Collectors.toUnmodifiableSet());
}

Supplier<IKnowledgeProvider> getProviderFor(UUID uuid) {
public Supplier<IKnowledgeProvider> getProviderFor(UUID uuid) {
return providers.get(uuid);
}

Expand Down

0 comments on commit d1dc3bf

Please sign in to comment.