Recache OreDict Buses on RegEx changes & adjust visibility logic (#395)

This commit is contained in:
Neeve
2024-02-05 13:05:31 +11:00
committed by GitHub
parent 0fffc829ab
commit 20a1fec6fb
3 changed files with 8 additions and 6 deletions
@@ -117,7 +117,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
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);
}
}
@@ -198,6 +198,10 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
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;
@@ -165,9 +165,7 @@ public class PartOreDicStorageBus extends PartStorageBus {
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();
}
}
@@ -196,7 +196,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
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;
}
@@ -319,7 +319,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
return TickRateModulation.SLEEP;
}
private void resetCache() {
protected void resetCache() {
final boolean fullReset = this.resetCacheLogic == 2;
this.resetCacheLogic = 0;