Skip to content

Commit

Permalink
Merge remote-tracking branch 'Demiu/master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Dream-Master committed Jul 28, 2024
2 parents a0b4a86 + 33689f6 commit d89109f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import appeng.container.guisync.GuiSync;
import appeng.container.slot.SlotRestrictedInput;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.util.IterationCounter;
import appeng.util.Platform;
import appeng.util.iterators.NullIterator;

Expand Down Expand Up @@ -156,7 +157,7 @@ public void partition() {
Iterator<IAEFluidStack> i = new NullIterator<>();
if (cellInv != null) {
final IItemList<IAEFluidStack> list = cellInv
.getAvailableItems(AEApi.instance().storage().createFluidList());
.getAvailableItems(AEApi.instance().storage().createFluidList(), IterationCounter.fetchNewId());
i = list.iterator();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import appeng.items.contents.CellConfig;
import appeng.items.contents.CellUpgrades;
import appeng.util.InventoryAdaptor;
import appeng.util.IterationCounter;
import appeng.util.Platform;
import appeng.util.ReadableNumberConverter;

Expand Down Expand Up @@ -224,7 +225,8 @@ protected boolean disassembleDrive(final ItemStack stack, final World world, fin
.getCellInventory(stack, null, StorageChannel.FLUIDS);
if (inv != null && playerInventory.getCurrentItem() == stack) {
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN);
final IItemList<IAEFluidStack> list = inv.getAvailableItems(StorageChannel.FLUIDS.createList());
final IItemList<IAEFluidStack> list = inv
.getAvailableItems(StorageChannel.FLUIDS.createList(), IterationCounter.fetchNewId());
if (list.isEmpty() && ia != null) {
playerInventory.setInventorySlotContents(playerInventory.currentItem, null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.tile.inventory.InvOperation;
import appeng.tile.networking.TileCableBus;
import appeng.util.IterationCounter;
import appeng.util.Platform;
import appeng.util.item.AEFluidStack;
import appeng.util.prioitylist.PrecisePriorityList;
Expand Down Expand Up @@ -207,11 +208,11 @@ protected void resetCache() {
if (!currentAccess.hasPermission(AccessRestriction.READ)) {
readOncePass = true;
}
before = in.getAvailableItems(before);
before = in.getAvailableItems(before, IterationCounter.fetchNewId());
in.setBaseAccess(currentAccess);
accessChanged = false;
} else {
before = in.getAvailableItems(before);
before = in.getAvailableItems(before, IterationCounter.fetchNewId());
}
}

Expand All @@ -225,7 +226,7 @@ protected void resetCache() {

if (in != out) {
if (out != null) {
after = out.getAvailableItems(after);
after = out.getAvailableItems(after, IterationCounter.fetchNewId());
}
Platform.postListChanges(before, after, this, this.source);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,15 +380,15 @@ public IAEFluidStack extractItems(IAEFluidStack request, Actionable mode, BaseAc
}

@Override
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out) {
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out, int iteration) {
for (final IAEFluidStack i : this.getCellFluids()) {
out.add(i);
}
return out;
}

@Override
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request) {
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request, int iteration) {
return this.getCellFluids().findPrecise(request);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActi
}

@Override
public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> out) {
public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> out, int iteration) {
if (itemCache == null) {
itemCache = AEApi.instance().storage().createItemList();
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
Expand All @@ -210,7 +210,7 @@ public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> out) {
}

@Override
public IAEItemStack getAvailableItem(@Nonnull IAEItemStack request) {
public IAEItemStack getAvailableItem(@Nonnull IAEItemStack request, int iteration) {
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
if (fluidGrid == null) {
return null;
Expand All @@ -219,7 +219,7 @@ public IAEItemStack getAvailableItem(@Nonnull IAEItemStack request) {
if (fluidRequest == null) {
return null;
}
IAEFluidStack availableFluid = fluidGrid.getAvailableItem(fluidRequest);
IAEFluidStack availableFluid = fluidGrid.getAvailableItem(fluidRequest, iteration);
if (availableFluid == null || availableFluid.getFluid() == null
|| FluidCraftAPI.instance().isBlacklistedInDisplay(availableFluid.getFluid().getClass())) {
return null;
Expand Down Expand Up @@ -297,12 +297,12 @@ public IAEFluidStack extractItems(IAEFluidStack request, Actionable mode, BaseAc
}

@Override
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out) {
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out, int iteration) {
return out;
}

@Override
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request) {
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request, int iteration) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public boolean validForPass(int i) {
return true;
}

public IItemList<IAEFluidStack> getAvailableItems(IItemList out) {
public IItemList<IAEFluidStack> getAvailableItems(IItemList out, int iteration) {

for (IAEFluidStack fs : this.cache) {
out.addStorage(fs);
Expand All @@ -194,7 +194,7 @@ public IItemList<IAEFluidStack> getAvailableItems(IItemList out) {
}

@Override
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request) {
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request, int iteration) {
return this.cache.findPrecise(request);
}

Expand Down

0 comments on commit d89109f

Please sign in to comment.