From 33689f681d93eae721e412020e13358615bbff6f Mon Sep 17 00:00:00 2001 From: Demiu Date: Thu, 25 Jul 2024 23:05:47 +0200 Subject: [PATCH] Adjust to AE2 api changes --- .../client/gui/container/ContainerFluidStorageBus.java | 3 ++- .../glodblock/github/common/item/FCBaseItemCell.java | 4 +++- .../github/common/parts/PartFluidStorageBus.java | 7 ++++--- .../github/common/storage/FluidCellInventory.java | 4 ++-- .../github/common/tile/TileFluidDiscretizer.java | 10 +++++----- .../github/inventory/MEMonitorIFluidHandler.java | 4 ++-- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/glodblock/github/client/gui/container/ContainerFluidStorageBus.java b/src/main/java/com/glodblock/github/client/gui/container/ContainerFluidStorageBus.java index 9c06106a6..cba712d50 100644 --- a/src/main/java/com/glodblock/github/client/gui/container/ContainerFluidStorageBus.java +++ b/src/main/java/com/glodblock/github/client/gui/container/ContainerFluidStorageBus.java @@ -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; @@ -156,7 +157,7 @@ public void partition() { Iterator i = new NullIterator<>(); if (cellInv != null) { final IItemList list = cellInv - .getAvailableItems(AEApi.instance().storage().createFluidList()); + .getAvailableItems(AEApi.instance().storage().createFluidList(), IterationCounter.fetchNewId()); i = list.iterator(); } diff --git a/src/main/java/com/glodblock/github/common/item/FCBaseItemCell.java b/src/main/java/com/glodblock/github/common/item/FCBaseItemCell.java index e63c78f57..d3f5b728b 100644 --- a/src/main/java/com/glodblock/github/common/item/FCBaseItemCell.java +++ b/src/main/java/com/glodblock/github/common/item/FCBaseItemCell.java @@ -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; @@ -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 list = inv.getAvailableItems(StorageChannel.FLUIDS.createList()); + final IItemList list = inv + .getAvailableItems(StorageChannel.FLUIDS.createList(), IterationCounter.fetchNewId()); if (list.isEmpty() && ia != null) { playerInventory.setInventorySlotContents(playerInventory.currentItem, null); diff --git a/src/main/java/com/glodblock/github/common/parts/PartFluidStorageBus.java b/src/main/java/com/glodblock/github/common/parts/PartFluidStorageBus.java index cc5032305..2c5146b36 100644 --- a/src/main/java/com/glodblock/github/common/parts/PartFluidStorageBus.java +++ b/src/main/java/com/glodblock/github/common/parts/PartFluidStorageBus.java @@ -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; @@ -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()); } } @@ -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); } diff --git a/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java b/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java index bf6396af0..55d8d2321 100644 --- a/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java +++ b/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java @@ -380,7 +380,7 @@ public IAEFluidStack extractItems(IAEFluidStack request, Actionable mode, BaseAc } @Override - public IItemList getAvailableItems(IItemList out) { + public IItemList getAvailableItems(IItemList out, int iteration) { for (final IAEFluidStack i : this.getCellFluids()) { out.add(i); } @@ -388,7 +388,7 @@ public IItemList getAvailableItems(IItemList out) } @Override - public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request) { + public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request, int iteration) { return this.getCellFluids().findPrecise(request); } diff --git a/src/main/java/com/glodblock/github/common/tile/TileFluidDiscretizer.java b/src/main/java/com/glodblock/github/common/tile/TileFluidDiscretizer.java index cd41c64a1..bedb3c53e 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileFluidDiscretizer.java +++ b/src/main/java/com/glodblock/github/common/tile/TileFluidDiscretizer.java @@ -189,7 +189,7 @@ public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActi } @Override - public IItemList getAvailableItems(IItemList out) { + public IItemList getAvailableItems(IItemList out, int iteration) { if (itemCache == null) { itemCache = AEApi.instance().storage().createItemList(); IMEMonitor fluidGrid = getFluidGrid(); @@ -210,7 +210,7 @@ public IItemList getAvailableItems(IItemList out) { } @Override - public IAEItemStack getAvailableItem(@Nonnull IAEItemStack request) { + public IAEItemStack getAvailableItem(@Nonnull IAEItemStack request, int iteration) { IMEMonitor fluidGrid = getFluidGrid(); if (fluidGrid == null) { return null; @@ -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; @@ -297,12 +297,12 @@ public IAEFluidStack extractItems(IAEFluidStack request, Actionable mode, BaseAc } @Override - public IItemList getAvailableItems(IItemList out) { + public IItemList getAvailableItems(IItemList out, int iteration) { return out; } @Override - public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request) { + public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request, int iteration) { return null; } diff --git a/src/main/java/com/glodblock/github/inventory/MEMonitorIFluidHandler.java b/src/main/java/com/glodblock/github/inventory/MEMonitorIFluidHandler.java index 8d0d70c59..1344b22b1 100644 --- a/src/main/java/com/glodblock/github/inventory/MEMonitorIFluidHandler.java +++ b/src/main/java/com/glodblock/github/inventory/MEMonitorIFluidHandler.java @@ -184,7 +184,7 @@ public boolean validForPass(int i) { return true; } - public IItemList getAvailableItems(IItemList out) { + public IItemList getAvailableItems(IItemList out, int iteration) { for (IAEFluidStack fs : this.cache) { out.addStorage(fs); @@ -194,7 +194,7 @@ public IItemList getAvailableItems(IItemList out) { } @Override - public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request) { + public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request, int iteration) { return this.cache.findPrecise(request); }