Skip to content

Commit

Permalink
Recache OreDict Buses on RegEx changes & adjust visibility logic (#395)
Browse files Browse the repository at this point in the history
  • Loading branch information
NotMyWing authored Feb 5, 2024
1 parent 0fffc82 commit 20a1fec
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/main/java/appeng/me/storage/MEInventoryHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public IItemList<T> getAvailableItems(final IItemList<T> out) {
if (this.storageFilter == StorageFilter.EXTRACTABLE_ONLY) {
var stackList = this.internal.getAvailableItems(this.getChannel().createList());
for (final T t : stackList) {
if (this.canExtract(t)) {
if (this.shouldItemBeAvailable(t)) {
out.add(t);
}
}
Expand Down Expand Up @@ -198,6 +198,10 @@ protected boolean canExtract(T request) {
return this.hasReadAccess;
}

private boolean shouldItemBeAvailable(T t) {
return this.hasReadAccess && this.passesBlackOrWhitelist(t);
}

public boolean passesBlackOrWhitelist(T input) {
if (this.myPartitionList.isEmpty()) {
return true;
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/appeng/parts/misc/PartOreDicStorageBus.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,7 @@ public void saveOreMatch(String oreMatch) {
this.oreExp = oreMatch;

this.priorityList = new OreDictPriorityList<>(OreHelper.INSTANCE.getMatchingOre(oreExp), oreExp);
if (this.handler != null) {
handler.setPartitionList(this.priorityList);
}
this.resetCache(true);
this.getHost().markForSave();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/appeng/parts/misc/PartStorageBus.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public IItemHandler getInventoryByName(final String name) {
return super.getInventoryByName(name);
}

private void resetCache(final boolean fullReset) {
protected void resetCache(final boolean fullReset) {
if (this.getHost() == null || this.getHost().getTile() == null || this.getHost().getTile().getWorld() == null || this.getHost().getTile().getWorld().isRemote) {
return;
}
Expand Down Expand Up @@ -319,7 +319,7 @@ public TickRateModulation tickingRequest(final IGridNode node, final int ticksSi
return TickRateModulation.SLEEP;
}

private void resetCache() {
protected void resetCache() {
final boolean fullReset = this.resetCacheLogic == 2;
this.resetCacheLogic = 0;

Expand Down

0 comments on commit 20a1fec

Please sign in to comment.