Skip to content

Commit

Permalink
Do not remove cached fluids to prevent excessive calls to `provideCra…
Browse files Browse the repository at this point in the history
…fting`
  • Loading branch information
Julia Dijkstra committed Feb 13, 2025
1 parent bedb2c2 commit e27aeb1
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ private IStorageGrid getStorageGrid() {
public void provideCrafting(ICraftingProviderHelper craftingTracker) {
IStorageGrid storage = getStorageGrid();
if (storage == null) return;
IItemList<IAEFluidStack> fluidStorage = this.fluids.isEmpty() ? storage.getFluidInventory().getStorageList()
: this.fluids;
for (IAEFluidStack fluidStack : fluidStorage) {
if (this.fluids.isEmpty()) {
this.fluids = storage.getFluidInventory().getStorageList();
}
for (IAEFluidStack fluidStack : this.fluids) {
Fluid fluid = fluidStack.getFluid();
if (fluid == null) continue;
int maxCapacity = Util.FluidUtil.getCapacity(this.getContainerItem(), fluid);
Expand Down Expand Up @@ -212,12 +213,10 @@ public void postChange(IBaseMonitor<IAEFluidStack> monitor, Iterable<IAEFluidSta
BaseActionSource source) {
if (this.getProxy().isActive() && this.getStorageGrid() != null) {
boolean hasChanged = false;
IItemList<IAEFluidStack> stored = this.getStorageGrid().getFluidInventory().getStorageList();
for (IAEFluidStack tmp : change) {
if (stored.findPrecise(tmp) == null || this.fluids.findPrecise(tmp) == null) {
if (this.fluids.findPrecise(tmp) == null) {
hasChanged = true;
this.fluids = stored;
break;
this.fluids.add(tmp);
}
}
if (hasChanged) postEvent();
Expand Down

0 comments on commit e27aeb1

Please sign in to comment.