From 2a17ce20fdb415907a3d9e831f592debdda03428 Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Thu, 4 Jun 2026 14:41:02 -0400 Subject: [PATCH 01/27] Added a mode to Super Stock Replenisher called Full-stock Mode --- dependencies.gradle | 2 +- .../github/client/gui/GuiFCImgButton.java | 2 + .../client/gui/GuiSuperStockReplenisher.java | 30 +++++- .../ContainerSuperStockReplenisher.java | 12 ++- .../tile/TileSuperStockReplenisher.java | 99 +++++++++++++++++-- .../github/loader/ChannelLoader.java | 7 ++ .../CPacketSuperStockReplenisherUpdate.java | 57 +++++++++++ .../SPacketSuperStockReplenisherUpdate.java | 8 +- .../resources/assets/ae2fc/lang/en_US.lang | 4 + .../resources/assets/ae2fc/lang/zh_CN.lang | 2 + 10 files changed, 209 insertions(+), 14 deletions(-) create mode 100644 src/main/java/com/glodblock/github/network/CPacketSuperStockReplenisherUpdate.java diff --git a/dependencies.gradle b/dependencies.gradle index eeb6cdf55..5fb7ce5cd 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -43,7 +43,7 @@ dependencies { compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.60:dev') {transitive = false} compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false } compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.23:dev') - compileOnly('com.github.GTNewHorizons:EnderIO:5.2.62:dev') + compileOnly('com.github.GTNewHorizons:EnderIO:2.10.27:dev') compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.42-GTNH:dev') { transitive = false } compileOnly("org.jetbrains:annotations:26.1.0") diff --git a/src/main/java/com/glodblock/github/client/gui/GuiFCImgButton.java b/src/main/java/com/glodblock/github/client/gui/GuiFCImgButton.java index d4974dea4..51dafdb91 100644 --- a/src/main/java/com/glodblock/github/client/gui/GuiFCImgButton.java +++ b/src/main/java/com/glodblock/github/client/gui/GuiFCImgButton.java @@ -75,6 +75,8 @@ public GuiFCImgButton(final int x, final int y, final String idx, final String v this.registerApp(33, "DISABLE_12x", "DISABLE", "disable"); this.registerApp(34, "RESTOCK", "ENABLE", "restock.on"); this.registerApp(35, "RESTOCK", "DISABLE", "restock.off"); + this.registerApp(36, "stock mode button", "fullstockMode", "Full-stock.mode"); + this.registerApp(37, "stock mode button", "normalMode", "Normal.mode"); } } diff --git a/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java b/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java index f48638f34..b2b99c862 100644 --- a/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java @@ -4,6 +4,7 @@ import java.util.HashMap; import java.util.Map; +import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; @@ -12,6 +13,7 @@ import com.glodblock.github.FluidCraft; import com.glodblock.github.client.gui.container.ContainerSuperStockReplenisher; import com.glodblock.github.common.tile.TileSuperStockReplenisher; +import com.glodblock.github.network.CPacketSuperStockReplenisherUpdate; import appeng.api.storage.StorageName; import appeng.api.storage.data.IAEStack; @@ -29,14 +31,18 @@ public class GuiSuperStockReplenisher extends AEBaseGui { private final DecimalFormat df = new DecimalFormat("#.#"); private Map> list = new HashMap<>(); private final ContainerSuperStockReplenisher containerSuperStockReplenisher; + private final TileSuperStockReplenisher tileSuperStockReplenisher; private final VirtualMEPhantomSlotPrecise[] configFluidsSlots = new VirtualMEPhantomSlotPrecise[9]; private final VirtualMEPhantomSlotPrecise[] configItemsSlots = new VirtualMEPhantomSlotPrecise[63]; + private GuiFCImgButton StockModeButton; + public GuiSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockReplenisher tile) { super(new ContainerSuperStockReplenisher(ipl, tile)); this.containerSuperStockReplenisher = (ContainerSuperStockReplenisher) inventorySlots; + this.tileSuperStockReplenisher = (TileSuperStockReplenisher) tile; this.ySize = 251; this.xSize = 216; @@ -45,6 +51,15 @@ public GuiSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockReplenisher t @Override public void initGui() { super.initGui(); + + this.StockModeButton = new GuiFCImgButton( + guiLeft - 18, + guiTop + 8, + "stock mode button", + this.tileSuperStockReplenisher.isFullStockMode() ? "fullstockMode" : "normalMode", + true); + + buttonList.add(this.StockModeButton); this.initSlots(); } @@ -125,8 +140,21 @@ public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) { this.drawTexturedModalRect(offsetX, offsetY, 0, 0, xSize, ySize); } - public void update(Map> map) { + @Override + protected void actionPerformed(final GuiButton btn) { + if (actionPerformedCustomButtons(btn)) return; + if (btn == StockModeButton) { + boolean newMode = !tileSuperStockReplenisher.isFullStockMode(); + this.tileSuperStockReplenisher.setFullStockMode(newMode); + StockModeButton.set(newMode ? "fullstockMode" : "normalMode"); + FluidCraft.proxy.netHandler.sendToServer(new CPacketSuperStockReplenisherUpdate(newMode)); + } + super.actionPerformed(btn); + } + + public void update(Map> map, boolean fullStockMode) { this.list = map; + this.tileSuperStockReplenisher.setFullStockMode(fullStockMode); } private boolean acceptType(VirtualMEPhantomSlot slot, IAEStackType type, int mouseButton) { diff --git a/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java b/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java index de7da75f7..6c010a8ce 100644 --- a/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java @@ -92,7 +92,9 @@ public void detectAndSendChanges() { for (final Object g : this.crafters) { if (g instanceof EntityPlayer) { - FluidCraft.proxy.netHandler.sendTo(new SPacketSuperStockReplenisherUpdate(tmp), (EntityPlayerMP) g); + FluidCraft.proxy.netHandler.sendTo( + new SPacketSuperStockReplenisherUpdate(tmp, this.tile.isFullStockMode()), + (EntityPlayerMP) g); } } } @@ -158,4 +160,12 @@ public void updateVirtualSlot(StorageName invName, int slotId, IAEStack aes) } } } + + public TileSuperStockReplenisher getTile() { + return this.tile; + } + + public void forceUpdate() { + this.lastUpdated = 21; + } } diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index bdab9e205..40551c6d3 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -91,16 +91,20 @@ public void readFromNBT(@Nullable NBTTagCompound data, String name) { private long totalBytes; private long storedFluidCount; private long storedItemCount; + protected boolean isFullStockMode; + protected boolean isSlotsAccessible; private boolean needReCountStoredFluids = true; private boolean needReCountStoredItems = true; public TileSuperStockReplenisher() { super(false); - getProxy().setIdlePowerUsage(4D); - getProxy().setFlags(GridFlags.REQUIRE_CHANNEL); + this.getProxy().setIdlePowerUsage(4D); + this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL); this.source = new MachineSource(this); invItems.setMaxStackSize(Integer.MAX_VALUE); + this.isFullStockMode = false; + this.isSlotsAccessible = true; } private TickRateModulation doWork() { @@ -123,7 +127,7 @@ private void fletchFluids() { else if (invFluid.equals(ifs)) { long invSize = invFluid.getStackSize(); long confSize = ifs.getStackSize(); - if (invSize < confSize / 2f) { + if (invSize < confSize / 2f || (this.isFullStockMode() && (invSize < confSize))) { ifs.setStackSize(confSize - invSize); requestFluid(ifs, i); } else if (invSize > confSize) { @@ -147,7 +151,8 @@ private void fletchItems() { if (invItem == null) requestItem(is, i); else if (is.equals(invItem)) { int confSize = (int) is.getStackSize(); - if (invItem.stackSize < confSize / 2f) { + if (invItem.stackSize < confSize / 2f + || (this.isFullStockMode() && (invItem.stackSize < confSize))) { is.setStackSize(confSize - invItem.stackSize); requestItem(is, i); } else if (invItem.stackSize > confSize) { @@ -207,6 +212,7 @@ private void requestFluid(IAEFluidStack fs, int index) { if (extracted != null) { storedFluidCount += extracted.getStackSize(); invFluids.fill(index, extracted, true); + checkSlotsAccessible(); } } catch (final GridAccessException ignored) {} } @@ -250,6 +256,7 @@ private void requestItem(IAEItemStack is, int index) { ItemStack tempStack = invItems.getStackInSlot(index); if (tempStack != null) { tempStack.stackSize = tempStack.stackSize + (int) extracted.getStackSize(); + checkSlotsAccessible(); saveChanges(); } else invItems.setInventorySlotContents(index, extracted.getItemStack()); @@ -259,9 +266,79 @@ private void requestItem(IAEItemStack is, int index) { } catch (final GridAccessException ignored) {} } + public boolean isFullStockMode() { + return this.isFullStockMode; + } + + public void setFullStockMode(boolean fullStockMode) { + + if (this.isFullStockMode == fullStockMode) return; + + this.isFullStockMode = fullStockMode; + checkSlotsAccessible(); + markDirty(); + } + + public boolean isSlotsAccessible() { + return this.isSlotsAccessible; + } + + public void setSlotsAccessible(boolean isSlotsAccessible) { + if (this.isSlotsAccessible != isSlotsAccessible) { + this.isSlotsAccessible = isSlotsAccessible; + this.notifyNeighbors(); + } + this.isSlotsAccessible = isSlotsAccessible; + } + + public void checkSlotsAccessible() { + if (this.isFullStockMode()) { + this.setSlotsAccessible(this.isFullyStocked()); + } else { + this.setSlotsAccessible(true); + } + } + + private boolean isFullyStocked() { + + for (int i = 0; i < 9; i++) { + IAEStack config = configFluids.getAEStackInSlot(i); + + if (config instanceof IAEFluidStack cfg) { + IAEFluidStack inv = invFluids.getFluidInSlot(i); + + if (inv == null || inv.getStackSize() < cfg.getStackSize()) { + return false; + } + } + } + + for (int i = 0; i < 63; i++) { + IAEStack config = configItems.getAEStackInSlot(i); + + if (config instanceof IAEItemStack cfg) { + ItemStack inv = invItems.getStackInSlot(i); + + if (inv == null || inv.stackSize < cfg.getStackSize()) { + return false; + } + } + } + + return true; + } + @Override public int[] getAccessibleSlotsBySide(ForgeDirection whichSide) { - return IntStream.rangeClosed(0, 62).toArray(); + return ((this.isFullStockMode() && !this.isSlotsAccessible()) ? new int[0] + : IntStream.rangeClosed(0, 62).toArray()); + } + + public void notifyNeighbors() { + if (this != null && this.getWorldObj() != null) { + this.getWorldObj().notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); + this.getWorldObj().markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + } } @Nonnull @@ -352,6 +429,8 @@ public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemSta } catch (GridAccessException e) { AELog.error(e, "Couldn't wake up level emitter for delayed updates"); } + + checkSlotsAccessible(); } public void fullRefund() { @@ -404,12 +483,12 @@ public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { @Override public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { - return invFluids.drain(from, resource, doDrain); + return (this.isFullStockMode() && !this.isSlotsAccessible()) ? null : invFluids.drain(from, resource, doDrain); } @Override public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { - return invFluids.drain(from, maxDrain, doDrain); + return (this.isFullStockMode() && !this.isSlotsAccessible()) ? null : invFluids.drain(from, maxDrain, doDrain); } @Override @@ -419,17 +498,19 @@ public boolean canFill(ForgeDirection from, Fluid fluid) { @Override public boolean canDrain(ForgeDirection from, Fluid fluid) { - return invFluids.canDrain(from, fluid); + return (this.isFullStockMode() && !this.isSlotsAccessible()) ? false : invFluids.canDrain(from, fluid); } @Override public FluidTankInfo[] getTankInfo(ForgeDirection from) { - return invFluids.getTankInfo(from); + return (this.isFullStockMode() && !this.isSlotsAccessible()) ? new FluidTankInfo[0] + : invFluids.getTankInfo(from); } @Override public void onFluidInventoryChanged(IAEFluidTank inv, int slot) { this.markDirty(); + checkSlotsAccessible(); } @Override diff --git a/src/main/java/com/glodblock/github/loader/ChannelLoader.java b/src/main/java/com/glodblock/github/loader/ChannelLoader.java index 62c4652c1..fef14fa3c 100644 --- a/src/main/java/com/glodblock/github/loader/ChannelLoader.java +++ b/src/main/java/com/glodblock/github/loader/ChannelLoader.java @@ -6,6 +6,7 @@ import com.glodblock.github.network.CPacketFluidPatternTermBtns; import com.glodblock.github.network.CPacketLevelMaintainer; import com.glodblock.github.network.CPacketLevelTerminalCommands; +import com.glodblock.github.network.CPacketSuperStockReplenisherUpdate; import com.glodblock.github.network.CPacketSwitchGuis; import com.glodblock.github.network.CPacketValueConfig; import com.glodblock.github.network.SPacketCustomButtonUpdate; @@ -39,6 +40,12 @@ public void run() { SPacketSuperStockReplenisherUpdate.class, id++, Side.CLIENT); + netHandler.registerMessage( + new CPacketSuperStockReplenisherUpdate.Handler(), + CPacketSuperStockReplenisherUpdate.class, + id++, + Side.SERVER); + netHandler.registerMessage(new CPacketValueConfig.Handler(), CPacketValueConfig.class, id++, Side.SERVER); netHandler .registerMessage(new CPacketLevelMaintainer.Handler(), CPacketLevelMaintainer.class, id++, Side.SERVER); diff --git a/src/main/java/com/glodblock/github/network/CPacketSuperStockReplenisherUpdate.java b/src/main/java/com/glodblock/github/network/CPacketSuperStockReplenisherUpdate.java new file mode 100644 index 000000000..f4bb20fbb --- /dev/null +++ b/src/main/java/com/glodblock/github/network/CPacketSuperStockReplenisherUpdate.java @@ -0,0 +1,57 @@ +package com.glodblock.github.network; + +import net.minecraft.inventory.Container; + +import com.glodblock.github.client.gui.container.ContainerSuperStockReplenisher; +import com.glodblock.github.common.tile.TileSuperStockReplenisher; +import com.gtnewhorizons.angelica.shadow.javax.annotation.Nullable; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import io.netty.buffer.ByteBuf; + +public class CPacketSuperStockReplenisherUpdate implements IMessage { + + private boolean isFullStockMode; + + public CPacketSuperStockReplenisherUpdate() {} + + public CPacketSuperStockReplenisherUpdate(boolean isFullStockMode) { + this.isFullStockMode = isFullStockMode; + } + + public boolean isFullStockMode() { + return this.isFullStockMode; + } + + @Override + public void fromBytes(ByteBuf buf) { + this.isFullStockMode = buf.readBoolean(); + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeBoolean(this.isFullStockMode); + } + + public static class Handler implements IMessageHandler { + + @Nullable + @Override + public IMessage onMessage(CPacketSuperStockReplenisherUpdate message, MessageContext ctx) { + final Container c = ctx.getServerHandler().playerEntity.openContainer; + + if (c instanceof ContainerSuperStockReplenisher cssr + && cssr.getTarget() instanceof TileSuperStockReplenisher tile) { + tile.setFullStockMode(message.isFullStockMode); + cssr.forceUpdate(); + tile.markDirty(); + cssr.detectAndSendChanges(); + } + + return null; + } + } + +} diff --git a/src/main/java/com/glodblock/github/network/SPacketSuperStockReplenisherUpdate.java b/src/main/java/com/glodblock/github/network/SPacketSuperStockReplenisherUpdate.java index e039fb704..f4f8e2856 100644 --- a/src/main/java/com/glodblock/github/network/SPacketSuperStockReplenisherUpdate.java +++ b/src/main/java/com/glodblock/github/network/SPacketSuperStockReplenisherUpdate.java @@ -19,16 +19,19 @@ public class SPacketSuperStockReplenisherUpdate implements IMessage { private Map> list; + private boolean isFullStockMode; public SPacketSuperStockReplenisherUpdate() {} - public SPacketSuperStockReplenisherUpdate(Map> data) { + public SPacketSuperStockReplenisherUpdate(Map> data, boolean isFullStockMode) { this.list = data; + this.isFullStockMode = isFullStockMode; } @Override public void fromBytes(ByteBuf buf) { this.list = new HashMap<>(); + this.isFullStockMode = buf.readBoolean(); try { Util.readAEStackMapFromBuf(this.list, buf); } catch (IOException e) { @@ -38,6 +41,7 @@ public void fromBytes(ByteBuf buf) { @Override public void toBytes(ByteBuf buf) { + buf.writeBoolean(this.isFullStockMode); try { Util.writeAEStackMapToBuf(this.list, buf); } catch (IOException e) { @@ -51,7 +55,7 @@ public static class Handler implements IMessageHandler Date: Thu, 4 Jun 2026 14:41:02 -0400 Subject: [PATCH 02/27] Added a mode to Super Stock Replenisher called Full-stock Mode --- dependencies.gradle | 2 +- .../github/client/gui/GuiFCImgButton.java | 2 + .../client/gui/GuiSuperStockReplenisher.java | 30 +++++- .../ContainerSuperStockReplenisher.java | 12 ++- .../tile/TileSuperStockReplenisher.java | 99 +++++++++++++++++-- .../github/loader/ChannelLoader.java | 7 ++ .../CPacketSuperStockReplenisherUpdate.java | 57 +++++++++++ .../SPacketSuperStockReplenisherUpdate.java | 8 +- .../resources/assets/ae2fc/lang/en_US.lang | 4 + .../resources/assets/ae2fc/lang/zh_CN.lang | 2 + 10 files changed, 209 insertions(+), 14 deletions(-) create mode 100644 src/main/java/com/glodblock/github/network/CPacketSuperStockReplenisherUpdate.java diff --git a/dependencies.gradle b/dependencies.gradle index eeb6cdf55..5fb7ce5cd 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -43,7 +43,7 @@ dependencies { compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.60:dev') {transitive = false} compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false } compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.23:dev') - compileOnly('com.github.GTNewHorizons:EnderIO:5.2.62:dev') + compileOnly('com.github.GTNewHorizons:EnderIO:2.10.27:dev') compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.42-GTNH:dev') { transitive = false } compileOnly("org.jetbrains:annotations:26.1.0") diff --git a/src/main/java/com/glodblock/github/client/gui/GuiFCImgButton.java b/src/main/java/com/glodblock/github/client/gui/GuiFCImgButton.java index d4974dea4..51dafdb91 100644 --- a/src/main/java/com/glodblock/github/client/gui/GuiFCImgButton.java +++ b/src/main/java/com/glodblock/github/client/gui/GuiFCImgButton.java @@ -75,6 +75,8 @@ public GuiFCImgButton(final int x, final int y, final String idx, final String v this.registerApp(33, "DISABLE_12x", "DISABLE", "disable"); this.registerApp(34, "RESTOCK", "ENABLE", "restock.on"); this.registerApp(35, "RESTOCK", "DISABLE", "restock.off"); + this.registerApp(36, "stock mode button", "fullstockMode", "Full-stock.mode"); + this.registerApp(37, "stock mode button", "normalMode", "Normal.mode"); } } diff --git a/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java b/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java index f48638f34..b2b99c862 100644 --- a/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java @@ -4,6 +4,7 @@ import java.util.HashMap; import java.util.Map; +import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; @@ -12,6 +13,7 @@ import com.glodblock.github.FluidCraft; import com.glodblock.github.client.gui.container.ContainerSuperStockReplenisher; import com.glodblock.github.common.tile.TileSuperStockReplenisher; +import com.glodblock.github.network.CPacketSuperStockReplenisherUpdate; import appeng.api.storage.StorageName; import appeng.api.storage.data.IAEStack; @@ -29,14 +31,18 @@ public class GuiSuperStockReplenisher extends AEBaseGui { private final DecimalFormat df = new DecimalFormat("#.#"); private Map> list = new HashMap<>(); private final ContainerSuperStockReplenisher containerSuperStockReplenisher; + private final TileSuperStockReplenisher tileSuperStockReplenisher; private final VirtualMEPhantomSlotPrecise[] configFluidsSlots = new VirtualMEPhantomSlotPrecise[9]; private final VirtualMEPhantomSlotPrecise[] configItemsSlots = new VirtualMEPhantomSlotPrecise[63]; + private GuiFCImgButton StockModeButton; + public GuiSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockReplenisher tile) { super(new ContainerSuperStockReplenisher(ipl, tile)); this.containerSuperStockReplenisher = (ContainerSuperStockReplenisher) inventorySlots; + this.tileSuperStockReplenisher = (TileSuperStockReplenisher) tile; this.ySize = 251; this.xSize = 216; @@ -45,6 +51,15 @@ public GuiSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockReplenisher t @Override public void initGui() { super.initGui(); + + this.StockModeButton = new GuiFCImgButton( + guiLeft - 18, + guiTop + 8, + "stock mode button", + this.tileSuperStockReplenisher.isFullStockMode() ? "fullstockMode" : "normalMode", + true); + + buttonList.add(this.StockModeButton); this.initSlots(); } @@ -125,8 +140,21 @@ public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) { this.drawTexturedModalRect(offsetX, offsetY, 0, 0, xSize, ySize); } - public void update(Map> map) { + @Override + protected void actionPerformed(final GuiButton btn) { + if (actionPerformedCustomButtons(btn)) return; + if (btn == StockModeButton) { + boolean newMode = !tileSuperStockReplenisher.isFullStockMode(); + this.tileSuperStockReplenisher.setFullStockMode(newMode); + StockModeButton.set(newMode ? "fullstockMode" : "normalMode"); + FluidCraft.proxy.netHandler.sendToServer(new CPacketSuperStockReplenisherUpdate(newMode)); + } + super.actionPerformed(btn); + } + + public void update(Map> map, boolean fullStockMode) { this.list = map; + this.tileSuperStockReplenisher.setFullStockMode(fullStockMode); } private boolean acceptType(VirtualMEPhantomSlot slot, IAEStackType type, int mouseButton) { diff --git a/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java b/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java index de7da75f7..6c010a8ce 100644 --- a/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java @@ -92,7 +92,9 @@ public void detectAndSendChanges() { for (final Object g : this.crafters) { if (g instanceof EntityPlayer) { - FluidCraft.proxy.netHandler.sendTo(new SPacketSuperStockReplenisherUpdate(tmp), (EntityPlayerMP) g); + FluidCraft.proxy.netHandler.sendTo( + new SPacketSuperStockReplenisherUpdate(tmp, this.tile.isFullStockMode()), + (EntityPlayerMP) g); } } } @@ -158,4 +160,12 @@ public void updateVirtualSlot(StorageName invName, int slotId, IAEStack aes) } } } + + public TileSuperStockReplenisher getTile() { + return this.tile; + } + + public void forceUpdate() { + this.lastUpdated = 21; + } } diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index bdab9e205..40551c6d3 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -91,16 +91,20 @@ public void readFromNBT(@Nullable NBTTagCompound data, String name) { private long totalBytes; private long storedFluidCount; private long storedItemCount; + protected boolean isFullStockMode; + protected boolean isSlotsAccessible; private boolean needReCountStoredFluids = true; private boolean needReCountStoredItems = true; public TileSuperStockReplenisher() { super(false); - getProxy().setIdlePowerUsage(4D); - getProxy().setFlags(GridFlags.REQUIRE_CHANNEL); + this.getProxy().setIdlePowerUsage(4D); + this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL); this.source = new MachineSource(this); invItems.setMaxStackSize(Integer.MAX_VALUE); + this.isFullStockMode = false; + this.isSlotsAccessible = true; } private TickRateModulation doWork() { @@ -123,7 +127,7 @@ private void fletchFluids() { else if (invFluid.equals(ifs)) { long invSize = invFluid.getStackSize(); long confSize = ifs.getStackSize(); - if (invSize < confSize / 2f) { + if (invSize < confSize / 2f || (this.isFullStockMode() && (invSize < confSize))) { ifs.setStackSize(confSize - invSize); requestFluid(ifs, i); } else if (invSize > confSize) { @@ -147,7 +151,8 @@ private void fletchItems() { if (invItem == null) requestItem(is, i); else if (is.equals(invItem)) { int confSize = (int) is.getStackSize(); - if (invItem.stackSize < confSize / 2f) { + if (invItem.stackSize < confSize / 2f + || (this.isFullStockMode() && (invItem.stackSize < confSize))) { is.setStackSize(confSize - invItem.stackSize); requestItem(is, i); } else if (invItem.stackSize > confSize) { @@ -207,6 +212,7 @@ private void requestFluid(IAEFluidStack fs, int index) { if (extracted != null) { storedFluidCount += extracted.getStackSize(); invFluids.fill(index, extracted, true); + checkSlotsAccessible(); } } catch (final GridAccessException ignored) {} } @@ -250,6 +256,7 @@ private void requestItem(IAEItemStack is, int index) { ItemStack tempStack = invItems.getStackInSlot(index); if (tempStack != null) { tempStack.stackSize = tempStack.stackSize + (int) extracted.getStackSize(); + checkSlotsAccessible(); saveChanges(); } else invItems.setInventorySlotContents(index, extracted.getItemStack()); @@ -259,9 +266,79 @@ private void requestItem(IAEItemStack is, int index) { } catch (final GridAccessException ignored) {} } + public boolean isFullStockMode() { + return this.isFullStockMode; + } + + public void setFullStockMode(boolean fullStockMode) { + + if (this.isFullStockMode == fullStockMode) return; + + this.isFullStockMode = fullStockMode; + checkSlotsAccessible(); + markDirty(); + } + + public boolean isSlotsAccessible() { + return this.isSlotsAccessible; + } + + public void setSlotsAccessible(boolean isSlotsAccessible) { + if (this.isSlotsAccessible != isSlotsAccessible) { + this.isSlotsAccessible = isSlotsAccessible; + this.notifyNeighbors(); + } + this.isSlotsAccessible = isSlotsAccessible; + } + + public void checkSlotsAccessible() { + if (this.isFullStockMode()) { + this.setSlotsAccessible(this.isFullyStocked()); + } else { + this.setSlotsAccessible(true); + } + } + + private boolean isFullyStocked() { + + for (int i = 0; i < 9; i++) { + IAEStack config = configFluids.getAEStackInSlot(i); + + if (config instanceof IAEFluidStack cfg) { + IAEFluidStack inv = invFluids.getFluidInSlot(i); + + if (inv == null || inv.getStackSize() < cfg.getStackSize()) { + return false; + } + } + } + + for (int i = 0; i < 63; i++) { + IAEStack config = configItems.getAEStackInSlot(i); + + if (config instanceof IAEItemStack cfg) { + ItemStack inv = invItems.getStackInSlot(i); + + if (inv == null || inv.stackSize < cfg.getStackSize()) { + return false; + } + } + } + + return true; + } + @Override public int[] getAccessibleSlotsBySide(ForgeDirection whichSide) { - return IntStream.rangeClosed(0, 62).toArray(); + return ((this.isFullStockMode() && !this.isSlotsAccessible()) ? new int[0] + : IntStream.rangeClosed(0, 62).toArray()); + } + + public void notifyNeighbors() { + if (this != null && this.getWorldObj() != null) { + this.getWorldObj().notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); + this.getWorldObj().markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + } } @Nonnull @@ -352,6 +429,8 @@ public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemSta } catch (GridAccessException e) { AELog.error(e, "Couldn't wake up level emitter for delayed updates"); } + + checkSlotsAccessible(); } public void fullRefund() { @@ -404,12 +483,12 @@ public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { @Override public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { - return invFluids.drain(from, resource, doDrain); + return (this.isFullStockMode() && !this.isSlotsAccessible()) ? null : invFluids.drain(from, resource, doDrain); } @Override public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { - return invFluids.drain(from, maxDrain, doDrain); + return (this.isFullStockMode() && !this.isSlotsAccessible()) ? null : invFluids.drain(from, maxDrain, doDrain); } @Override @@ -419,17 +498,19 @@ public boolean canFill(ForgeDirection from, Fluid fluid) { @Override public boolean canDrain(ForgeDirection from, Fluid fluid) { - return invFluids.canDrain(from, fluid); + return (this.isFullStockMode() && !this.isSlotsAccessible()) ? false : invFluids.canDrain(from, fluid); } @Override public FluidTankInfo[] getTankInfo(ForgeDirection from) { - return invFluids.getTankInfo(from); + return (this.isFullStockMode() && !this.isSlotsAccessible()) ? new FluidTankInfo[0] + : invFluids.getTankInfo(from); } @Override public void onFluidInventoryChanged(IAEFluidTank inv, int slot) { this.markDirty(); + checkSlotsAccessible(); } @Override diff --git a/src/main/java/com/glodblock/github/loader/ChannelLoader.java b/src/main/java/com/glodblock/github/loader/ChannelLoader.java index 62c4652c1..fef14fa3c 100644 --- a/src/main/java/com/glodblock/github/loader/ChannelLoader.java +++ b/src/main/java/com/glodblock/github/loader/ChannelLoader.java @@ -6,6 +6,7 @@ import com.glodblock.github.network.CPacketFluidPatternTermBtns; import com.glodblock.github.network.CPacketLevelMaintainer; import com.glodblock.github.network.CPacketLevelTerminalCommands; +import com.glodblock.github.network.CPacketSuperStockReplenisherUpdate; import com.glodblock.github.network.CPacketSwitchGuis; import com.glodblock.github.network.CPacketValueConfig; import com.glodblock.github.network.SPacketCustomButtonUpdate; @@ -39,6 +40,12 @@ public void run() { SPacketSuperStockReplenisherUpdate.class, id++, Side.CLIENT); + netHandler.registerMessage( + new CPacketSuperStockReplenisherUpdate.Handler(), + CPacketSuperStockReplenisherUpdate.class, + id++, + Side.SERVER); + netHandler.registerMessage(new CPacketValueConfig.Handler(), CPacketValueConfig.class, id++, Side.SERVER); netHandler .registerMessage(new CPacketLevelMaintainer.Handler(), CPacketLevelMaintainer.class, id++, Side.SERVER); diff --git a/src/main/java/com/glodblock/github/network/CPacketSuperStockReplenisherUpdate.java b/src/main/java/com/glodblock/github/network/CPacketSuperStockReplenisherUpdate.java new file mode 100644 index 000000000..f4bb20fbb --- /dev/null +++ b/src/main/java/com/glodblock/github/network/CPacketSuperStockReplenisherUpdate.java @@ -0,0 +1,57 @@ +package com.glodblock.github.network; + +import net.minecraft.inventory.Container; + +import com.glodblock.github.client.gui.container.ContainerSuperStockReplenisher; +import com.glodblock.github.common.tile.TileSuperStockReplenisher; +import com.gtnewhorizons.angelica.shadow.javax.annotation.Nullable; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import io.netty.buffer.ByteBuf; + +public class CPacketSuperStockReplenisherUpdate implements IMessage { + + private boolean isFullStockMode; + + public CPacketSuperStockReplenisherUpdate() {} + + public CPacketSuperStockReplenisherUpdate(boolean isFullStockMode) { + this.isFullStockMode = isFullStockMode; + } + + public boolean isFullStockMode() { + return this.isFullStockMode; + } + + @Override + public void fromBytes(ByteBuf buf) { + this.isFullStockMode = buf.readBoolean(); + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeBoolean(this.isFullStockMode); + } + + public static class Handler implements IMessageHandler { + + @Nullable + @Override + public IMessage onMessage(CPacketSuperStockReplenisherUpdate message, MessageContext ctx) { + final Container c = ctx.getServerHandler().playerEntity.openContainer; + + if (c instanceof ContainerSuperStockReplenisher cssr + && cssr.getTarget() instanceof TileSuperStockReplenisher tile) { + tile.setFullStockMode(message.isFullStockMode); + cssr.forceUpdate(); + tile.markDirty(); + cssr.detectAndSendChanges(); + } + + return null; + } + } + +} diff --git a/src/main/java/com/glodblock/github/network/SPacketSuperStockReplenisherUpdate.java b/src/main/java/com/glodblock/github/network/SPacketSuperStockReplenisherUpdate.java index e039fb704..f4f8e2856 100644 --- a/src/main/java/com/glodblock/github/network/SPacketSuperStockReplenisherUpdate.java +++ b/src/main/java/com/glodblock/github/network/SPacketSuperStockReplenisherUpdate.java @@ -19,16 +19,19 @@ public class SPacketSuperStockReplenisherUpdate implements IMessage { private Map> list; + private boolean isFullStockMode; public SPacketSuperStockReplenisherUpdate() {} - public SPacketSuperStockReplenisherUpdate(Map> data) { + public SPacketSuperStockReplenisherUpdate(Map> data, boolean isFullStockMode) { this.list = data; + this.isFullStockMode = isFullStockMode; } @Override public void fromBytes(ByteBuf buf) { this.list = new HashMap<>(); + this.isFullStockMode = buf.readBoolean(); try { Util.readAEStackMapFromBuf(this.list, buf); } catch (IOException e) { @@ -38,6 +41,7 @@ public void fromBytes(ByteBuf buf) { @Override public void toBytes(ByteBuf buf) { + buf.writeBoolean(this.isFullStockMode); try { Util.writeAEStackMapToBuf(this.list, buf); } catch (IOException e) { @@ -51,7 +55,7 @@ public static class Handler implements IMessageHandler Date: Fri, 5 Jun 2026 07:50:59 -0400 Subject: [PATCH 03/27] Fixed config ISEItemStack and FluidStack not being copied while checking slot inventories --- .../tile/TileSuperStockReplenisher.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index 710f16ba5..a1d675177 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -143,6 +143,7 @@ else if (invFluid.equals(ifs)) { returnFluid(i, Long.MAX_VALUE); } } + checkSlotsAccessible(); } private void fletchItems() { @@ -153,10 +154,10 @@ private void fletchItems() { IAEItemStack is = ais.copy(); if (invItem == null) requestItem(is, i); else if (is.equals(invItem)) { + int invSize = invItem.stackSize; int confSize = (int) is.getStackSize(); - if (invItem.stackSize < confSize / 2f - || (this.isFullStockMode() && (invItem.stackSize < confSize))) { - is.setStackSize(confSize - invItem.stackSize); + if (invSize < confSize / 2f || (this.isFullStockMode() && (invSize < confSize))) { + is.setStackSize(confSize - invSize); requestItem(is, i); } else if (invItem.stackSize > confSize) { returnItem(i, invItem.stackSize - confSize); @@ -168,6 +169,7 @@ else if (is.equals(invItem)) { returnItem(i, Integer.MAX_VALUE); } } + checkSlotsAccessible(); } private void countFluids() { @@ -215,7 +217,6 @@ private void requestFluid(IAEFluidStack fs, int index) { if (extracted != null) { storedFluidCount += extracted.getStackSize(); invFluids.fill(index, extracted, true); - checkSlotsAccessible(); } } catch (final GridAccessException ignored) {} } @@ -259,7 +260,6 @@ private void requestItem(IAEItemStack is, int index) { ItemStack tempStack = invItems.getStackInSlot(index); if (tempStack != null) { tempStack.stackSize = tempStack.stackSize + (int) extracted.getStackSize(); - checkSlotsAccessible(); saveChanges(); } else invItems.setInventorySlotContents(index, extracted.getItemStack()); @@ -283,7 +283,8 @@ public void setFullStockMode(boolean fullStockMode) { } public boolean isSlotsAccessible() { - return this.isSlotsAccessible; + return !this.isFullStockMode() || this.isFullyStocked(); + // return this.isSlotsAccessible; } public void setSlotsAccessible(boolean isSlotsAccessible) { @@ -308,9 +309,11 @@ private boolean isFullyStocked() { IAEStack config = configFluids.getAEStackInSlot(i); if (config instanceof IAEFluidStack cfg) { + IAEFluidStack cfgFis = cfg.copy(); + IAEFluidStack inv = invFluids.getFluidInSlot(i); - if (inv == null || inv.getStackSize() < cfg.getStackSize()) { + if (inv == null || inv.getStackSize() < cfgFis.getStackSize()) { return false; } } @@ -319,10 +322,13 @@ private boolean isFullyStocked() { for (int i = 0; i < 63; i++) { IAEStack config = configItems.getAEStackInSlot(i); + System.out.println("Checking slot " + i + ": " + config); + if (config instanceof IAEItemStack cfg) { + IAEItemStack cfgIs = cfg.copy(); ItemStack inv = invItems.getStackInSlot(i); - if (inv == null || inv.stackSize < cfg.getStackSize()) { + if (inv == null || inv.stackSize < (int) cfgIs.getStackSize()) { return false; } } @@ -333,12 +339,13 @@ private boolean isFullyStocked() { @Override public int[] getAccessibleSlotsBySide(ForgeDirection whichSide) { - return ((this.isFullStockMode() && !this.isSlotsAccessible()) ? new int[0] + return ((this.isFullStockMode() && !this.isFullyStocked()) ? new int[0] : IntStream.rangeClosed(0, 62).toArray()); } public void notifyNeighbors() { if (this != null && this.getWorldObj() != null) { + this.markDirty(); this.getWorldObj().notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); this.getWorldObj().markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); } From abdc292f7c4dabaa5b1527b6b9428fa79b408268 Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Fri, 5 Jun 2026 23:34:09 -0400 Subject: [PATCH 04/27] Minor rework and more fixes for config IAEItemStack and IAEFluidStack not being copied while checking slot inventories --- .../tile/TileSuperStockReplenisher.java | 138 +++++++++++++----- .../resources/assets/ae2fc/lang/en_US.lang | 2 +- 2 files changed, 106 insertions(+), 34 deletions(-) diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index a1d675177..3dfeb5352 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -36,6 +36,7 @@ import appeng.api.networking.events.MENetworkBootingStatusChange; import appeng.api.networking.events.MENetworkEventSubscribe; import appeng.api.networking.events.MENetworkPowerStatusChange; +import appeng.api.networking.events.MENetworkStorageEvent; import appeng.api.networking.security.BaseActionSource; import appeng.api.networking.security.MachineSource; import appeng.api.networking.ticking.IGridTickable; @@ -72,6 +73,7 @@ public class TileSuperStockReplenisher extends AENetworkInvTile implements IAEFl private final AppEngInternalInventory cell = new AppEngInternalInventory(this, 1); private final BiggerAppEngInventory invItems = new BiggerAppEngInventory(this, 63); private final AEFluidInventory invFluids = new AEFluidInventory(this, 9, Integer.MAX_VALUE); + private final IAEStackInventory configItems = new IAEStackInventory(this, 63, StorageName.CONFIG); private final IAEStackInventory configFluids = new IAEStackInventory(this, 9, StorageName.NONE) { @Override @@ -88,7 +90,6 @@ public void readFromNBT(@Nullable NBTTagCompound data, String name) { } } }; - private final IAEStackInventory configItems = new IAEStackInventory(this, 63, StorageName.CONFIG); private final BaseActionSource source; private boolean isPowered; private long totalBytes; @@ -96,6 +97,7 @@ public void readFromNBT(@Nullable NBTTagCompound data, String name) { private long storedItemCount; protected boolean isFullStockMode; protected boolean isSlotsAccessible; + protected boolean modeChange; private boolean needReCountStoredFluids = true; private boolean needReCountStoredItems = true; @@ -108,6 +110,7 @@ public TileSuperStockReplenisher() { invItems.setMaxStackSize(Integer.MAX_VALUE); this.isFullStockMode = false; this.isSlotsAccessible = true; + this.modeChange = false; } private TickRateModulation doWork() { @@ -130,7 +133,8 @@ private void fletchFluids() { else if (invFluid.equals(ifs)) { long invSize = invFluid.getStackSize(); long confSize = ifs.getStackSize(); - if (invSize < confSize / 2f || (this.isFullStockMode() && (invSize < confSize))) { + if (!this.isFullStockMode() && (invSize < confSize / 2f) + || (this.isFullStockMode() && needsFullyStocked())) { ifs.setStackSize(confSize - invSize); requestFluid(ifs, i); } else if (invSize > confSize) { @@ -143,7 +147,6 @@ else if (invFluid.equals(ifs)) { returnFluid(i, Long.MAX_VALUE); } } - checkSlotsAccessible(); } private void fletchItems() { @@ -156,7 +159,8 @@ private void fletchItems() { else if (is.equals(invItem)) { int invSize = invItem.stackSize; int confSize = (int) is.getStackSize(); - if (invSize < confSize / 2f || (this.isFullStockMode() && (invSize < confSize))) { + if ((!this.isFullStockMode() && (invSize < confSize / 2f)) + || ((this.isFullStockMode()) && (invSize < confSize))) { is.setStackSize(confSize - invSize); requestItem(is, i); } else if (invItem.stackSize > confSize) { @@ -169,7 +173,6 @@ else if (is.equals(invItem)) { returnItem(i, Integer.MAX_VALUE); } } - checkSlotsAccessible(); } private void countFluids() { @@ -237,13 +240,15 @@ private void returnItem(int index, int amount) { IAEItemStack notInserted = this.getProxy().getStorage().getItemInventory() .injectItems(AEItemStack.create(is), Actionable.MODULATE, this.source); if (notInserted != null) { - ItemStack tempStack = invItems.getStackInSlot(index); - if (tempStack != null) { + if (invItems.getStackInSlot(index) != null) { + ItemStack tempStack = invItems.getStackInSlot(index).copy(); tempStack.stackSize = tempStack.stackSize + (int) notInserted.getStackSize(); - - saveChanges(); - } else invItems.setInventorySlotContents(index, notInserted.getItemStack()); - + invItems.setInventorySlotContents(index, tempStack); + checkSlotsAccessible(); + } else { + invItems.setInventorySlotContents(index, notInserted.getItemStack()); + checkSlotsAccessible(); + } this.storedItemCount += notInserted.getStackSize(); } } catch (final GridAccessException ignored) {} @@ -257,12 +262,17 @@ private void requestItem(IAEItemStack is, int index) { IAEItemStack extracted = this.getProxy().getStorage().getItemInventory() .extractItems(is, Actionable.MODULATE, this.source); if (extracted != null) { - ItemStack tempStack = invItems.getStackInSlot(index); - if (tempStack != null) { + if (invItems.getStackInSlot(index) != null) { + ItemStack tempStack = invItems.getStackInSlot(index).copy(); tempStack.stackSize = tempStack.stackSize + (int) extracted.getStackSize(); + invItems.setInventorySlotContents(index, tempStack); + checkSlotsAccessible(); - saveChanges(); - } else invItems.setInventorySlotContents(index, extracted.getItemStack()); + // saveChanges(); + } else { + invItems.setInventorySlotContents(index, extracted.getItemStack()); + checkSlotsAccessible(); + } this.storedItemCount += extracted.getStackSize(); } @@ -277,30 +287,88 @@ public void setFullStockMode(boolean fullStockMode) { if (this.isFullStockMode == fullStockMode) return; + if (fullStockMode) this.modeChange = true; + this.isFullStockMode = fullStockMode; checkSlotsAccessible(); - markDirty(); + this.modeChange = false; } public boolean isSlotsAccessible() { - return !this.isFullStockMode() || this.isFullyStocked(); - // return this.isSlotsAccessible; + return this.isSlotsAccessible; } - public void setSlotsAccessible(boolean isSlotsAccessible) { - if (this.isSlotsAccessible != isSlotsAccessible) { - this.isSlotsAccessible = isSlotsAccessible; - this.notifyNeighbors(); - } - this.isSlotsAccessible = isSlotsAccessible; + public boolean hasModeChanged() { + return this.modeChange; + } + + public void setSlotsAccessible() { + if (((this.isFullStockMode() && this.needsFullyStocked()) && (this.isSlotsAccessible())) + || (this.hasModeChanged())) { + try { + this.getProxy().getGrid().postEvent( + new MENetworkStorageEvent( + this.getProxy().getStorage().getItemInventory(), + this.invItems.getMEInventory().getStackType())); + } catch (GridAccessException ignored) {} + + this.isSlotsAccessible = false; + + } else if (((this.isFullStockMode() && this.isFullyStocked()) && (!this.isSlotsAccessible())) + || (!this.isFullStockMode())) { + try { + this.getProxy().getGrid().postEvent( + new MENetworkStorageEvent( + this.getProxy().getStorage().getItemInventory(), + this.invItems.getMEInventory().getStackType())); + } catch (GridAccessException ignored) {} + + this.isSlotsAccessible = true; + + } + + System.out.println(this.isSlotsAccessible()); + } public void checkSlotsAccessible() { - if (this.isFullStockMode()) { - this.setSlotsAccessible(this.isFullyStocked()); - } else { - this.setSlotsAccessible(true); + this.setSlotsAccessible(); + this.notifyNeighbors(); + } + + private boolean needsFullyStocked() { + int configSlots = 0; + int emptySlots = 0; + + for (int i = 0; i < 9; i++) { + IAEStack config = configFluids.getAEStackInSlot(i); + + if (config instanceof IAEFluidStack cfg) { + configSlots++; + IAEFluidStack inv = invFluids.getFluidInSlot(i); + + if (inv == null) { + emptySlots++; + } + } + } + + for (int i = 0; i < 63; i++) { + IAEStack config = configItems.getAEStackInSlot(i); + + // System.out.println("Checking slot " + i + ": " + config); + + if (config instanceof IAEItemStack cfg) { + configSlots++; + ItemStack inv = invItems.getStackInSlot(i); + + if (inv == null) { + emptySlots++; + } + } } + + return emptySlots == configSlots; } private boolean isFullyStocked() { @@ -310,7 +378,6 @@ private boolean isFullyStocked() { if (config instanceof IAEFluidStack cfg) { IAEFluidStack cfgFis = cfg.copy(); - IAEFluidStack inv = invFluids.getFluidInSlot(i); if (inv == null || inv.getStackSize() < cfgFis.getStackSize()) { @@ -322,7 +389,7 @@ private boolean isFullyStocked() { for (int i = 0; i < 63; i++) { IAEStack config = configItems.getAEStackInSlot(i); - System.out.println("Checking slot " + i + ": " + config); + // System.out.println("Checking slot " + i + ": " + config); if (config instanceof IAEItemStack cfg) { IAEItemStack cfgIs = cfg.copy(); @@ -339,8 +406,12 @@ private boolean isFullyStocked() { @Override public int[] getAccessibleSlotsBySide(ForgeDirection whichSide) { - return ((this.isFullStockMode() && !this.isFullyStocked()) ? new int[0] - : IntStream.rangeClosed(0, 62).toArray()); + return ((this.isSlotsAccessible()) ? IntStream.rangeClosed(0, 62).toArray() : new int[0]); + } + + @Override + public boolean canExtractItem(int slotIndex, ItemStack itemStackIn, int side) { + return this.isSlotsAccessible(); } public void notifyNeighbors() { @@ -548,7 +619,7 @@ public void readFromNBTEvent(NBTTagCompound data) { configFluids.readFromNBT(data, "configFluids"); cell.readFromNBT(data, "cellHolder"); isFullStockMode = data.getBoolean("isFullStockMode"); - checkSlotsAccessible(); + isSlotsAccessible = data.getBoolean("isSlotsAccessible"); totalBytes = data.getLong("totalBytes"); getProxy().setIdlePowerUsage(data.getDouble("powerDraw")); } @@ -561,6 +632,7 @@ public NBTTagCompound writeToNBTEvent(NBTTagCompound data) { configFluids.writeToNBT(data, "configFluids"); cell.writeToNBT(data, "cellHolder"); data.setBoolean("isFullStockMode", isFullStockMode); + data.setBoolean("isSlotsAccessible", isSlotsAccessible); data.setLong("totalBytes", totalBytes); data.setDouble("powerDraw", getProxy().getIdlePowerUsage()); return data; diff --git a/src/main/resources/assets/ae2fc/lang/en_US.lang b/src/main/resources/assets/ae2fc/lang/en_US.lang index c04044fae..63a87a653 100644 --- a/src/main/resources/assets/ae2fc/lang/en_US.lang +++ b/src/main/resources/assets/ae2fc/lang/en_US.lang @@ -175,7 +175,7 @@ ae2fc.tooltip.restock.on.hint=Enable ae2fc.tooltip.restock.off=Toggle Restock ae2fc.tooltip.restock.off.hint=Disable ae2fc.tooltip.Full-stock.mode=Full-stock Mode -ae2fc.tooltip.Full-stock.mode.hint=Stocked items and fluids only visible to storage busses when all are fully stocked, and always fully restocked +ae2fc.tooltip.Full-stock.mode.hint=Stocked items and fluids always visible to storage busses and only after all are fully stocked following the replenisher being fully emptied, and always fully restocked ae2fc.tooltip.Normal.mode=Normal Mode ae2fc.tooltip.Normal.mode.hint=Stocked items and fluids always visible to storage busses, and only restocked when below 50% From 71c388d2f0b1c8e73ffbbbf053168aab789c5c22 Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Sun, 7 Jun 2026 14:13:00 -0400 Subject: [PATCH 05/27] Some adjustments and fluid support --- .../tile/TileSuperStockReplenisher.java | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index 3dfeb5352..2597fb960 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -134,7 +134,7 @@ else if (invFluid.equals(ifs)) { long invSize = invFluid.getStackSize(); long confSize = ifs.getStackSize(); if (!this.isFullStockMode() && (invSize < confSize / 2f) - || (this.isFullStockMode() && needsFullyStocked())) { + || (this.isFullStockMode() && (invSize < confSize))) { ifs.setStackSize(confSize - invSize); requestFluid(ifs, i); } else if (invSize > confSize) { @@ -206,6 +206,7 @@ private void returnFluid(int index, long amount) { if (notInserted != null) { invFluids.fill(index, notInserted, true); storedFluidCount += notInserted.getStackSize(); + checkSlotsAccessible(); } } catch (final GridAccessException ignored) {} } @@ -220,6 +221,7 @@ private void requestFluid(IAEFluidStack fs, int index) { if (extracted != null) { storedFluidCount += extracted.getStackSize(); invFluids.fill(index, extracted, true); + checkSlotsAccessible(); } } catch (final GridAccessException ignored) {} } @@ -303,8 +305,8 @@ public boolean hasModeChanged() { } public void setSlotsAccessible() { - if (((this.isFullStockMode() && this.needsFullyStocked()) && (this.isSlotsAccessible())) - || (this.hasModeChanged())) { + if (((this.isFullStockMode() && this.isFullyStocked()) && (!this.isSlotsAccessible())) + || (!this.isFullStockMode())) { try { this.getProxy().getGrid().postEvent( new MENetworkStorageEvent( @@ -312,10 +314,10 @@ public void setSlotsAccessible() { this.invItems.getMEInventory().getStackType())); } catch (GridAccessException ignored) {} - this.isSlotsAccessible = false; + this.isSlotsAccessible = true; - } else if (((this.isFullStockMode() && this.isFullyStocked()) && (!this.isSlotsAccessible())) - || (!this.isFullStockMode())) { + } else if (((this.isFullStockMode() && this.needsFullyStocked()) && (this.isSlotsAccessible())) + || (this.hasModeChanged())) { try { this.getProxy().getGrid().postEvent( new MENetworkStorageEvent( @@ -323,9 +325,18 @@ public void setSlotsAccessible() { this.invItems.getMEInventory().getStackType())); } catch (GridAccessException ignored) {} - this.isSlotsAccessible = true; + this.isSlotsAccessible = false; - } + } else + if ((this.isFullStockMode() && this.isFullyStocked()) && (this.isSlotsAccessible())) { + try { + this.getProxy().getGrid().postEvent( + new MENetworkStorageEvent( + this.getProxy().getStorage().getItemInventory(), + this.invItems.getMEInventory().getStackType())); + } catch (GridAccessException ignored) {} + + } System.out.println(this.isSlotsAccessible()); @@ -368,7 +379,7 @@ private boolean needsFullyStocked() { } } - return emptySlots == configSlots; + return (emptySlots == configSlots) && (configSlots > 0); } private boolean isFullyStocked() { @@ -619,6 +630,7 @@ public void readFromNBTEvent(NBTTagCompound data) { configFluids.readFromNBT(data, "configFluids"); cell.readFromNBT(data, "cellHolder"); isFullStockMode = data.getBoolean("isFullStockMode"); + checkSlotsAccessible(); isSlotsAccessible = data.getBoolean("isSlotsAccessible"); totalBytes = data.getLong("totalBytes"); getProxy().setIdlePowerUsage(data.getDouble("powerDraw")); From 9b8552075aca2addc97a583c5ac74ffed185cbc9 Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Sun, 7 Jun 2026 14:13:00 -0400 Subject: [PATCH 06/27] Some adjustments and fluid support --- .../tile/TileSuperStockReplenisher.java | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index 3dfeb5352..ea7469374 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -134,7 +134,7 @@ else if (invFluid.equals(ifs)) { long invSize = invFluid.getStackSize(); long confSize = ifs.getStackSize(); if (!this.isFullStockMode() && (invSize < confSize / 2f) - || (this.isFullStockMode() && needsFullyStocked())) { + || (this.isFullStockMode() && (invSize < confSize))) { ifs.setStackSize(confSize - invSize); requestFluid(ifs, i); } else if (invSize > confSize) { @@ -206,6 +206,7 @@ private void returnFluid(int index, long amount) { if (notInserted != null) { invFluids.fill(index, notInserted, true); storedFluidCount += notInserted.getStackSize(); + checkSlotsAccessible(); } } catch (final GridAccessException ignored) {} } @@ -220,6 +221,7 @@ private void requestFluid(IAEFluidStack fs, int index) { if (extracted != null) { storedFluidCount += extracted.getStackSize(); invFluids.fill(index, extracted, true); + checkSlotsAccessible(); } } catch (final GridAccessException ignored) {} } @@ -303,8 +305,8 @@ public boolean hasModeChanged() { } public void setSlotsAccessible() { - if (((this.isFullStockMode() && this.needsFullyStocked()) && (this.isSlotsAccessible())) - || (this.hasModeChanged())) { + if (((this.isFullStockMode() && this.isFullyStocked()) && (!this.isSlotsAccessible())) + || (!this.isFullStockMode())) { try { this.getProxy().getGrid().postEvent( new MENetworkStorageEvent( @@ -312,10 +314,10 @@ public void setSlotsAccessible() { this.invItems.getMEInventory().getStackType())); } catch (GridAccessException ignored) {} - this.isSlotsAccessible = false; + this.isSlotsAccessible = true; - } else if (((this.isFullStockMode() && this.isFullyStocked()) && (!this.isSlotsAccessible())) - || (!this.isFullStockMode())) { + } else if (((this.isFullStockMode() && this.needsFullyStocked()) && (this.isSlotsAccessible())) + || (this.hasModeChanged())) { try { this.getProxy().getGrid().postEvent( new MENetworkStorageEvent( @@ -323,11 +325,18 @@ public void setSlotsAccessible() { this.invItems.getMEInventory().getStackType())); } catch (GridAccessException ignored) {} - this.isSlotsAccessible = true; + this.isSlotsAccessible = false; - } + } else + if ((this.isFullStockMode() && this.isFullyStocked()) && (this.isSlotsAccessible())) { + try { + this.getProxy().getGrid().postEvent( + new MENetworkStorageEvent( + this.getProxy().getStorage().getItemInventory(), + this.invItems.getMEInventory().getStackType())); + } catch (GridAccessException ignored) {} - System.out.println(this.isSlotsAccessible()); + } } @@ -368,7 +377,7 @@ private boolean needsFullyStocked() { } } - return emptySlots == configSlots; + return (emptySlots == configSlots) && (configSlots > 0); } private boolean isFullyStocked() { @@ -389,8 +398,6 @@ private boolean isFullyStocked() { for (int i = 0; i < 63; i++) { IAEStack config = configItems.getAEStackInSlot(i); - // System.out.println("Checking slot " + i + ": " + config); - if (config instanceof IAEItemStack cfg) { IAEItemStack cfgIs = cfg.copy(); ItemStack inv = invItems.getStackInSlot(i); @@ -619,6 +626,7 @@ public void readFromNBTEvent(NBTTagCompound data) { configFluids.readFromNBT(data, "configFluids"); cell.readFromNBT(data, "cellHolder"); isFullStockMode = data.getBoolean("isFullStockMode"); + checkSlotsAccessible(); isSlotsAccessible = data.getBoolean("isSlotsAccessible"); totalBytes = data.getLong("totalBytes"); getProxy().setIdlePowerUsage(data.getDouble("powerDraw")); From e5e7ebf1f066dbdce57e7ad457aac49502434ae3 Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Sun, 7 Jun 2026 14:13:00 -0400 Subject: [PATCH 07/27] Merge --- .../tile/TileSuperStockReplenisher.java | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index 3dfeb5352..a9884d91d 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -134,7 +134,7 @@ else if (invFluid.equals(ifs)) { long invSize = invFluid.getStackSize(); long confSize = ifs.getStackSize(); if (!this.isFullStockMode() && (invSize < confSize / 2f) - || (this.isFullStockMode() && needsFullyStocked())) { + || (this.isFullStockMode() && (invSize < confSize))) { ifs.setStackSize(confSize - invSize); requestFluid(ifs, i); } else if (invSize > confSize) { @@ -206,6 +206,7 @@ private void returnFluid(int index, long amount) { if (notInserted != null) { invFluids.fill(index, notInserted, true); storedFluidCount += notInserted.getStackSize(); + checkSlotsAccessible(); } } catch (final GridAccessException ignored) {} } @@ -220,6 +221,7 @@ private void requestFluid(IAEFluidStack fs, int index) { if (extracted != null) { storedFluidCount += extracted.getStackSize(); invFluids.fill(index, extracted, true); + checkSlotsAccessible(); } } catch (final GridAccessException ignored) {} } @@ -303,8 +305,8 @@ public boolean hasModeChanged() { } public void setSlotsAccessible() { - if (((this.isFullStockMode() && this.needsFullyStocked()) && (this.isSlotsAccessible())) - || (this.hasModeChanged())) { + if (((this.isFullStockMode() && this.isFullyStocked()) && (!this.isSlotsAccessible())) + || (!this.isFullStockMode())) { try { this.getProxy().getGrid().postEvent( new MENetworkStorageEvent( @@ -312,10 +314,10 @@ public void setSlotsAccessible() { this.invItems.getMEInventory().getStackType())); } catch (GridAccessException ignored) {} - this.isSlotsAccessible = false; + this.isSlotsAccessible = true; - } else if (((this.isFullStockMode() && this.isFullyStocked()) && (!this.isSlotsAccessible())) - || (!this.isFullStockMode())) { + } else if (((this.isFullStockMode() && this.needsFullyStocked()) && (this.isSlotsAccessible())) + || (this.hasModeChanged())) { try { this.getProxy().getGrid().postEvent( new MENetworkStorageEvent( @@ -323,11 +325,18 @@ public void setSlotsAccessible() { this.invItems.getMEInventory().getStackType())); } catch (GridAccessException ignored) {} - this.isSlotsAccessible = true; + this.isSlotsAccessible = false; - } + } else + if ((this.isFullStockMode() && this.isFullyStocked()) && (this.isSlotsAccessible())) { + try { + this.getProxy().getGrid().postEvent( + new MENetworkStorageEvent( + this.getProxy().getStorage().getItemInventory(), + this.invItems.getMEInventory().getStackType())); + } catch (GridAccessException ignored) {} - System.out.println(this.isSlotsAccessible()); + } } @@ -356,8 +365,6 @@ private boolean needsFullyStocked() { for (int i = 0; i < 63; i++) { IAEStack config = configItems.getAEStackInSlot(i); - // System.out.println("Checking slot " + i + ": " + config); - if (config instanceof IAEItemStack cfg) { configSlots++; ItemStack inv = invItems.getStackInSlot(i); @@ -368,7 +375,7 @@ private boolean needsFullyStocked() { } } - return emptySlots == configSlots; + return (emptySlots == configSlots) && (configSlots > 0); } private boolean isFullyStocked() { @@ -389,8 +396,6 @@ private boolean isFullyStocked() { for (int i = 0; i < 63; i++) { IAEStack config = configItems.getAEStackInSlot(i); - // System.out.println("Checking slot " + i + ": " + config); - if (config instanceof IAEItemStack cfg) { IAEItemStack cfgIs = cfg.copy(); ItemStack inv = invItems.getStackInSlot(i); @@ -619,6 +624,7 @@ public void readFromNBTEvent(NBTTagCompound data) { configFluids.readFromNBT(data, "configFluids"); cell.readFromNBT(data, "cellHolder"); isFullStockMode = data.getBoolean("isFullStockMode"); + checkSlotsAccessible(); isSlotsAccessible = data.getBoolean("isSlotsAccessible"); totalBytes = data.getLong("totalBytes"); getProxy().setIdlePowerUsage(data.getDouble("powerDraw")); From 1cc839274a2b76c956ed12c770608199ac8ecd31 Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Sun, 7 Jun 2026 16:14:02 -0400 Subject: [PATCH 08/27] Merge From 809b2121d0138d0cd2095059a4862ccc3a39d8d9 Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Sun, 7 Jun 2026 16:15:40 -0400 Subject: [PATCH 09/27] Some adjustments and fluid support --- .../glodblock/github/common/tile/TileSuperStockReplenisher.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index a9884d91d..d81449f84 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -405,7 +405,6 @@ private boolean isFullyStocked() { } } } - return true; } From 66d41a328e5943bb53d16073ded046d8870ea1c0 Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Sun, 7 Jun 2026 16:17:53 -0400 Subject: [PATCH 10/27] Merge cleanup --- .../github/common/tile/TileSuperStockReplenisher.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index fc164b294..d81449f84 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -326,7 +326,6 @@ public void setSlotsAccessible() { } catch (GridAccessException ignored) {} this.isSlotsAccessible = false; - this.isSlotsAccessible = false; } else if ((this.isFullStockMode() && this.isFullyStocked()) && (this.isSlotsAccessible())) { @@ -338,16 +337,6 @@ public void setSlotsAccessible() { } catch (GridAccessException ignored) {} } - } else - if ((this.isFullStockMode() && this.isFullyStocked()) && (this.isSlotsAccessible())) { - try { - this.getProxy().getGrid().postEvent( - new MENetworkStorageEvent( - this.getProxy().getStorage().getItemInventory(), - this.invItems.getMEInventory().getStackType())); - } catch (GridAccessException ignored) {} - - } } From 2e8957afabc20745ce6cb2b7fc972be853962b8b Mon Sep 17 00:00:00 2001 From: PLASMAchicken Date: Sun, 7 Jun 2026 23:38:22 +0200 Subject: [PATCH 11/27] ci opti image --- .../assets/ae2fc/textures/gui/states2.png | Bin 1432 -> 1065 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/main/resources/assets/ae2fc/textures/gui/states2.png b/src/main/resources/assets/ae2fc/textures/gui/states2.png index cc06a951da85005bbaf659c647cc7704fd5ef114..578f33d798d4729791c9844f0dc781f862eaeb1c 100644 GIT binary patch delta 589 zcmV-T03#kaO=mCEMD@jB_RA}Dqn7vK|F$~9#_h9U!^cC0<69WSSVq;;TL&a2< zN{9|@NF5OjmDu^15KmA#GBO)EQckJsI8NG2qEbti?k?x+|CiX#^_pfI>}WKG=TLg$np{fA7PNB{L zu*b&&*qAD6fQr$i5C>4K3vIHERka(TcY&2%+NJ>!l!8#9truf&iZJ>;SRis{%+7Urh?7ieD02 zs)*tD`__1(_$2_>vjdfoQXgPolZvRGj4ZCoz*N=Z{i^T#`eK;IK z>39PG^GWOY1;Ra-91Gr!|Jm;?jhj715syM79}EWUb@P9jg#w^)5VXKK05liE1(4z; z!FU`7V9bT!X41A?F5W`exKO+_+Z09(;6lU#SO^MWKaz0((oFl(DEkV803`9;N~mif z2oR_N4S+^49b*A}1*`$^b)gslt@tDWw}Y@NK%S8b5Gv^IQiwcbQz_&t=;$K$3D9;i zU%ZqyQa444ZlkdPbR{H!&~7Z(K;ae8%r=)+(KX-&$WR0FMyBjST7Y%BP^bo00PI1k bmyZ7ffmA-kOV~!?00000NkvXXu0mjfW5EjJ delta 959 zcmV;w13>(#2$&17=mCENnn^@KRA@u(mOp3{Q5?s=FC=Mgz@Z3=n9)I88>HYOoK$ge zaO>2%=wP8mse|aCbT9=QXqST27BLj1qr^zSMQ~_3mJW6hl0c!-p^$2l!{?B^^xf~? z{dt#Mqop4>xcj~Lefj==_j~UG{O2$LxI4ed2>UDl4NiKO#S5QfVeCES{al{uLr<9g|ROSb8r%3r(+y06?Qw zqj67kG=)NedG)r8&U^*{Pd|R*FK*pv3q++esdRf|)ApenfmiQ(84IL;^nT4E^79>_ znx69D&0B3VK{R2|+{E<;je8PA69x>&;m_O&Cj=+V9;Sb%R4Bitv#2oSN5hM)>ANUn zo9$zQUxrU@C~&^9!1>x3S5%h5i{Lzml9kxiwgc?WG90wL z2##HpaT7^Mb9fG=P~L>)@3aD&`B$r7EfZ7_^8mnFv99BmfYSWK58LQw1v|wlfsV}Q zPy*?9-im*99aRFIm}f(+DN+)l^*i_y_h8um>$ z^sG{;@biB@w}VqVTbMg{$uiN2>*MdRva$l9-y46P!Qi(i?QxbI2QR&m6jp>jo6XW8 z3#Mrz8jaF0^7*{|6q*})iK(3}8U{;_TP_uYrSI4qo}ppDr(R&1rt)4zGl2_ZhnFG= zQAzo-n2@xpBs}#Js%nd8RWi0WAfQR;ph^O*_H^VIz|PKr--bV)|gzMrZbhe^*n_pW_tqyrzCXH zSwlAEW}f1hKqs47;CBr_hE*FFT|Y+28ksj#n$Glv{vMFfHm{%?Yf!WFS-@szXL&xK hr*YqmjEta{`oG3yS77FnN*VwF002ovPDHLkV1i`Z$uR%` From 6800a99e378e261df63789aadc625848e497aa6d Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Wed, 10 Jun 2026 11:29:40 -0400 Subject: [PATCH 12/27] Resolve conversation: simplify if-checks --- .../tile/TileSuperStockReplenisher.java | 55 +++++++++---------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index d81449f84..a8208d211 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -300,43 +300,40 @@ public boolean isSlotsAccessible() { return this.isSlotsAccessible; } - public boolean hasModeChanged() { + public boolean hasModeChangedToTrue() { return this.modeChange; } public void setSlotsAccessible() { - if (((this.isFullStockMode() && this.isFullyStocked()) && (!this.isSlotsAccessible())) - || (!this.isFullStockMode())) { - try { - this.getProxy().getGrid().postEvent( - new MENetworkStorageEvent( - this.getProxy().getStorage().getItemInventory(), - this.invItems.getMEInventory().getStackType())); - } catch (GridAccessException ignored) {} + if (this.isFullStockMode()) { - this.isSlotsAccessible = true; + if (this.hasModeChangedToTrue()) { - } else if (((this.isFullStockMode() && this.needsFullyStocked()) && (this.isSlotsAccessible())) - || (this.hasModeChanged())) { - try { - this.getProxy().getGrid().postEvent( - new MENetworkStorageEvent( - this.getProxy().getStorage().getItemInventory(), - this.invItems.getMEInventory().getStackType())); - } catch (GridAccessException ignored) {} - - this.isSlotsAccessible = false; - - } else - if ((this.isFullStockMode() && this.isFullyStocked()) && (this.isSlotsAccessible())) { - try { - this.getProxy().getGrid().postEvent( - new MENetworkStorageEvent( - this.getProxy().getStorage().getItemInventory(), - this.invItems.getMEInventory().getStackType())); - } catch (GridAccessException ignored) {} + this.isSlotsAccessible = false; } + if ((this.needsFullyStocked()) && (this.isSlotsAccessible())) { + + this.isSlotsAccessible = false; + + } else if ((this.isFullyStocked()) && (!this.isSlotsAccessible())) { + + this.isSlotsAccessible = true; + + } + + } else { + + this.isSlotsAccessible = true; + + } + + try { + this.getProxy().getGrid().postEvent( + new MENetworkStorageEvent( + this.getProxy().getStorage().getItemInventory(), + this.invItems.getMEInventory().getStackType())); + } catch (GridAccessException ignored) {} } From 47bbb3ac289f5e0105b96a354e7e3da38ec5415d Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Wed, 10 Jun 2026 16:21:41 -0400 Subject: [PATCH 13/27] Resolve conversation: simplify if-checks some more --- .../github/common/tile/TileSuperStockReplenisher.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index a8208d211..10ab127f4 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -312,13 +312,13 @@ public void setSlotsAccessible() { this.isSlotsAccessible = false; } - if ((this.needsFullyStocked()) && (this.isSlotsAccessible())) { + if (this.isSlotsAccessible()) { - this.isSlotsAccessible = false; + if ((this.needsFullyStocked())) this.isSlotsAccessible = false; - } else if ((this.isFullyStocked()) && (!this.isSlotsAccessible())) { + } else { - this.isSlotsAccessible = true; + if (this.isFullyStocked()) this.isSlotsAccessible = true; } From 78450a6d684acd4a76645e710fb674fb0e56ebcb Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Wed, 10 Jun 2026 16:35:49 -0400 Subject: [PATCH 14/27] Made tickrate ramp up if Full-stock mode is on --- .../github/common/tile/TileSuperStockReplenisher.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index 10ab127f4..b45761fab 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -685,7 +685,9 @@ public AECableType getCableConnectionType(ForgeDirection dir) { @Override public TickingRequest getTickingRequest(IGridNode node) { - return new TickingRequest(120, 120, false, false); + if (isFullStockMode()) { + return new TickingRequest(10, 120, false, false); + } else return new TickingRequest(120, 120, false, false); } @Override From a88d51b52e11c2d5b1cbaf00d189747890b36166 Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Wed, 10 Jun 2026 16:35:49 -0400 Subject: [PATCH 15/27] Made tickrate ramp up if Full-stock mode is on --- .../tile/TileSuperStockReplenisher.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index 10ab127f4..c267cb438 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -97,6 +97,7 @@ public void readFromNBT(@Nullable NBTTagCompound data, String name) { private long storedItemCount; protected boolean isFullStockMode; protected boolean isSlotsAccessible; + protected boolean isNeedsFullyStocked; protected boolean modeChange; private boolean needReCountStoredFluids = true; @@ -110,6 +111,7 @@ public TileSuperStockReplenisher() { invItems.setMaxStackSize(Integer.MAX_VALUE); this.isFullStockMode = false; this.isSlotsAccessible = true; + this.isNeedsFullyStocked = false; this.modeChange = false; } @@ -120,7 +122,11 @@ private TickRateModulation doWork() { this.needReCountStoredFluids = true; this.needReCountStoredItems = true; - return TickRateModulation.SAME; + if (this.isFullStockMode()) { + if (this.isNeedsFullyStocked()) { + return TickRateModulation.FASTER; + } else return TickRateModulation.SLOWER; + } else return TickRateModulation.SAME; } private void fletchFluids() { @@ -300,6 +306,10 @@ public boolean isSlotsAccessible() { return this.isSlotsAccessible; } + public boolean isNeedsFullyStocked() { + return this.isNeedsFullyStocked; + } + public boolean hasModeChangedToTrue() { return this.modeChange; } @@ -372,7 +382,9 @@ private boolean needsFullyStocked() { } } - return (emptySlots == configSlots) && (configSlots > 0); + this.isNeedsFullyStocked = (emptySlots == configSlots) && (configSlots > 0) + + return isNeedsFullyStocked; } private boolean isFullyStocked() { @@ -685,7 +697,9 @@ public AECableType getCableConnectionType(ForgeDirection dir) { @Override public TickingRequest getTickingRequest(IGridNode node) { - return new TickingRequest(120, 120, false, false); + if (isFullStockMode()) { + return new TickingRequest(10, 120, false, false); + } else return new TickingRequest(120, 120, false, false); } @Override From d891e1cea244d68676c1c4fa51c2f540f6994526 Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Wed, 10 Jun 2026 19:25:42 -0400 Subject: [PATCH 16/27] Attempt two at making tickrate ramp up if Full-stock mode is on --- .../common/tile/TileSuperStockReplenisher.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index fadf19394..3ed9fe1bb 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -116,17 +116,21 @@ public TileSuperStockReplenisher() { } private TickRateModulation doWork() { + String tickRateModulation = "IDLE"; + + if (this.isFullStockMode()) { + if (this.isNeedsFullyStocked()) { + tickRateModulation = "FASTER"; + } else tickRateModulation = "SLOWER"; + } + this.fletchFluids(); this.fletchItems(); this.needReCountStoredFluids = true; this.needReCountStoredItems = true; - if (this.isFullStockMode()) { - if (this.isNeedsFullyStocked()) { - return TickRateModulation.FASTER; - } else return TickRateModulation.SLOWER; - } else return TickRateModulation.SAME; + return TickRateModulation.valueOf(tickRateModulation); } private void fletchFluids() { @@ -697,9 +701,7 @@ public AECableType getCableConnectionType(ForgeDirection dir) { @Override public TickingRequest getTickingRequest(IGridNode node) { - if (isFullStockMode()) { - return new TickingRequest(10, 120, false, false); - } else return new TickingRequest(120, 120, false, false); + return new TickingRequest(10, 120, false, false); } @Override From 3722a6a3994a2a6c6f002eae898f994901929d13 Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Thu, 11 Jun 2026 15:06:43 -0400 Subject: [PATCH 17/27] Resolve conversation: use new SyncManager class from AE2 --- .../client/gui/GuiSuperStockReplenisher.java | 12 +++++------ .../ContainerSuperStockReplenisher.java | 21 ++++++++++++++++--- .../SPacketSuperStockReplenisherUpdate.java | 8 ++----- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java b/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java index b2b99c862..15ecab4d9 100644 --- a/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java @@ -13,7 +13,6 @@ import com.glodblock.github.FluidCraft; import com.glodblock.github.client.gui.container.ContainerSuperStockReplenisher; import com.glodblock.github.common.tile.TileSuperStockReplenisher; -import com.glodblock.github.network.CPacketSuperStockReplenisherUpdate; import appeng.api.storage.StorageName; import appeng.api.storage.data.IAEStack; @@ -42,7 +41,7 @@ public GuiSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockReplenisher t super(new ContainerSuperStockReplenisher(ipl, tile)); this.containerSuperStockReplenisher = (ContainerSuperStockReplenisher) inventorySlots; - this.tileSuperStockReplenisher = (TileSuperStockReplenisher) tile; + this.tileSuperStockReplenisher = tile; this.ySize = 251; this.xSize = 216; @@ -144,17 +143,16 @@ public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) { protected void actionPerformed(final GuiButton btn) { if (actionPerformedCustomButtons(btn)) return; if (btn == StockModeButton) { - boolean newMode = !tileSuperStockReplenisher.isFullStockMode(); - this.tileSuperStockReplenisher.setFullStockMode(newMode); + boolean newMode = !containerSuperStockReplenisher.isFullStockMode(); + this.containerSuperStockReplenisher.setFullStockMode(newMode); StockModeButton.set(newMode ? "fullstockMode" : "normalMode"); - FluidCraft.proxy.netHandler.sendToServer(new CPacketSuperStockReplenisherUpdate(newMode)); + this.containerSuperStockReplenisher.forceUpdate(); } super.actionPerformed(btn); } - public void update(Map> map, boolean fullStockMode) { + public void update(Map> map) { this.list = map; - this.tileSuperStockReplenisher.setFullStockMode(fullStockMode); } private boolean acceptType(VirtualMEPhantomSlot slot, IAEStackType type, int mouseButton) { diff --git a/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java b/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java index 6c010a8ce..ad01bf178 100644 --- a/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java @@ -27,6 +27,7 @@ import appeng.container.slot.SlotRestrictedInput; import appeng.container.sync.SyncManager; import appeng.container.sync.handlers.AEStackInventorySyncHandler; +import appeng.container.sync.handlers.BooleanSyncHandler; import appeng.items.storage.ItemBasicStorageCell; import appeng.tile.inventory.IAEStackInventory; import appeng.util.Platform; @@ -44,6 +45,8 @@ public class ContainerSuperStockReplenisher extends AEBaseContainer implements I private final IAEStackInventory configItems; public final AEStackInventorySyncHandler configItemsSlots; + private final BooleanSyncHandler fullStockModeSync; + public ContainerSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockReplenisher tile) { super(ipl, tile); this.tile = tile; @@ -54,6 +57,8 @@ public ContainerSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockRepleni final SyncManager sm = this.getSyncManager(); this.configFluidsSlots = sm.root().aeStackInventory("fluidConfig", this.configFluids); this.configItemsSlots = sm.root().aeStackInventory("itemConfig", this.configItems); + this.fullStockModeSync = sm.root().booleanSync("fullstockMode").onClientChange((oldValue, newValue) -> {}) + .onServerChange((oldValue, newValue) -> this.tile.setFullStockMode(newValue)); this.addSlotToContainer( new SlotRestrictedInput( @@ -92,11 +97,12 @@ public void detectAndSendChanges() { for (final Object g : this.crafters) { if (g instanceof EntityPlayer) { - FluidCraft.proxy.netHandler.sendTo( - new SPacketSuperStockReplenisherUpdate(tmp, this.tile.isFullStockMode()), - (EntityPlayerMP) g); + FluidCraft.proxy.netHandler.sendTo(new SPacketSuperStockReplenisherUpdate(tmp), (EntityPlayerMP) g); } } + + if (Platform.isServer()) this.setFullStockMode(this.tile.isFullStockMode()); + } this.lastUpdated++; @@ -167,5 +173,14 @@ public TileSuperStockReplenisher getTile() { public void forceUpdate() { this.lastUpdated = 21; + this.detectAndSendChanges(); + } + + public boolean isFullStockMode() { + return this.fullStockModeSync.get(); + } + + public void setFullStockMode(final boolean fullStockMode) { + this.fullStockModeSync.set(fullStockMode); } } diff --git a/src/main/java/com/glodblock/github/network/SPacketSuperStockReplenisherUpdate.java b/src/main/java/com/glodblock/github/network/SPacketSuperStockReplenisherUpdate.java index f4f8e2856..e039fb704 100644 --- a/src/main/java/com/glodblock/github/network/SPacketSuperStockReplenisherUpdate.java +++ b/src/main/java/com/glodblock/github/network/SPacketSuperStockReplenisherUpdate.java @@ -19,19 +19,16 @@ public class SPacketSuperStockReplenisherUpdate implements IMessage { private Map> list; - private boolean isFullStockMode; public SPacketSuperStockReplenisherUpdate() {} - public SPacketSuperStockReplenisherUpdate(Map> data, boolean isFullStockMode) { + public SPacketSuperStockReplenisherUpdate(Map> data) { this.list = data; - this.isFullStockMode = isFullStockMode; } @Override public void fromBytes(ByteBuf buf) { this.list = new HashMap<>(); - this.isFullStockMode = buf.readBoolean(); try { Util.readAEStackMapFromBuf(this.list, buf); } catch (IOException e) { @@ -41,7 +38,6 @@ public void fromBytes(ByteBuf buf) { @Override public void toBytes(ByteBuf buf) { - buf.writeBoolean(this.isFullStockMode); try { Util.writeAEStackMapToBuf(this.list, buf); } catch (IOException e) { @@ -55,7 +51,7 @@ public static class Handler implements IMessageHandler Date: Fri, 12 Jun 2026 07:53:32 -0400 Subject: [PATCH 18/27] Resolve conversation: `CPacketSuperStockReplenisher` is no longer required --- .../CPacketSuperStockReplenisherUpdate.java | 57 ------------------- 1 file changed, 57 deletions(-) delete mode 100644 src/main/java/com/glodblock/github/network/CPacketSuperStockReplenisherUpdate.java diff --git a/src/main/java/com/glodblock/github/network/CPacketSuperStockReplenisherUpdate.java b/src/main/java/com/glodblock/github/network/CPacketSuperStockReplenisherUpdate.java deleted file mode 100644 index f4bb20fbb..000000000 --- a/src/main/java/com/glodblock/github/network/CPacketSuperStockReplenisherUpdate.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.glodblock.github.network; - -import net.minecraft.inventory.Container; - -import com.glodblock.github.client.gui.container.ContainerSuperStockReplenisher; -import com.glodblock.github.common.tile.TileSuperStockReplenisher; -import com.gtnewhorizons.angelica.shadow.javax.annotation.Nullable; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import io.netty.buffer.ByteBuf; - -public class CPacketSuperStockReplenisherUpdate implements IMessage { - - private boolean isFullStockMode; - - public CPacketSuperStockReplenisherUpdate() {} - - public CPacketSuperStockReplenisherUpdate(boolean isFullStockMode) { - this.isFullStockMode = isFullStockMode; - } - - public boolean isFullStockMode() { - return this.isFullStockMode; - } - - @Override - public void fromBytes(ByteBuf buf) { - this.isFullStockMode = buf.readBoolean(); - } - - @Override - public void toBytes(ByteBuf buf) { - buf.writeBoolean(this.isFullStockMode); - } - - public static class Handler implements IMessageHandler { - - @Nullable - @Override - public IMessage onMessage(CPacketSuperStockReplenisherUpdate message, MessageContext ctx) { - final Container c = ctx.getServerHandler().playerEntity.openContainer; - - if (c instanceof ContainerSuperStockReplenisher cssr - && cssr.getTarget() instanceof TileSuperStockReplenisher tile) { - tile.setFullStockMode(message.isFullStockMode); - cssr.forceUpdate(); - tile.markDirty(); - cssr.detectAndSendChanges(); - } - - return null; - } - } - -} From 6c148a470f411599aa1e81532e965627c9824362 Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Fri, 12 Jun 2026 08:00:05 -0400 Subject: [PATCH 19/27] Resolve conversation: Removed dependency for `CPacketSuperStockReplenisher` --- .../java/com/glodblock/github/loader/ChannelLoader.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/main/java/com/glodblock/github/loader/ChannelLoader.java b/src/main/java/com/glodblock/github/loader/ChannelLoader.java index fef14fa3c..62c4652c1 100644 --- a/src/main/java/com/glodblock/github/loader/ChannelLoader.java +++ b/src/main/java/com/glodblock/github/loader/ChannelLoader.java @@ -6,7 +6,6 @@ import com.glodblock.github.network.CPacketFluidPatternTermBtns; import com.glodblock.github.network.CPacketLevelMaintainer; import com.glodblock.github.network.CPacketLevelTerminalCommands; -import com.glodblock.github.network.CPacketSuperStockReplenisherUpdate; import com.glodblock.github.network.CPacketSwitchGuis; import com.glodblock.github.network.CPacketValueConfig; import com.glodblock.github.network.SPacketCustomButtonUpdate; @@ -40,12 +39,6 @@ public void run() { SPacketSuperStockReplenisherUpdate.class, id++, Side.CLIENT); - netHandler.registerMessage( - new CPacketSuperStockReplenisherUpdate.Handler(), - CPacketSuperStockReplenisherUpdate.class, - id++, - Side.SERVER); - netHandler.registerMessage(new CPacketValueConfig.Handler(), CPacketValueConfig.class, id++, Side.SERVER); netHandler .registerMessage(new CPacketLevelMaintainer.Handler(), CPacketLevelMaintainer.class, id++, Side.SERVER); From 92fe38fdedf26c80a0ee67c0f51238e5b93180ea Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Fri, 12 Jun 2026 18:04:29 -0400 Subject: [PATCH 20/27] Resolve conversation: tweaked `doWork()` to assign `TickRateModulation` to variable instead of `String` --- .../github/common/tile/TileSuperStockReplenisher.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index 3ed9fe1bb..0515b67a4 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -116,13 +116,13 @@ public TileSuperStockReplenisher() { } private TickRateModulation doWork() { - String tickRateModulation = "IDLE"; + final TickRateModulation tickRateModulation; if (this.isFullStockMode()) { if (this.isNeedsFullyStocked()) { - tickRateModulation = "FASTER"; - } else tickRateModulation = "SLOWER"; - } + tickRateModulation = TickRateModulation.FASTER; + } else tickRateModulation = TickRateModulation.SLOWER; + } else tickRateModulation = TickRateModulation.IDLE; this.fletchFluids(); this.fletchItems(); @@ -130,7 +130,7 @@ private TickRateModulation doWork() { this.needReCountStoredFluids = true; this.needReCountStoredItems = true; - return TickRateModulation.valueOf(tickRateModulation); + return tickRateModulation; } private void fletchFluids() { From 00f2c628e72793eb117e1e14057a7763708b33ea Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Sat, 13 Jun 2026 21:50:20 -0400 Subject: [PATCH 21/27] Resolve conversation: clean up commented code --- .../glodblock/github/common/tile/TileSuperStockReplenisher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index 0515b67a4..9d831e9ea 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -280,10 +280,10 @@ private void requestItem(IAEItemStack is, int index) { invItems.setInventorySlotContents(index, tempStack); checkSlotsAccessible(); - // saveChanges(); } else { invItems.setInventorySlotContents(index, extracted.getItemStack()); checkSlotsAccessible(); + } this.storedItemCount += extracted.getStackSize(); From cb3579ab37431d529f88c6e4e3822ddf89b2a326 Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Thu, 18 Jun 2026 12:30:25 -0400 Subject: [PATCH 22/27] Resolve conversation: use `flushPendingSync()` instead of `forceUpdate()` for GUI synchronization --- .../client/gui/GuiSuperStockReplenisher.java | 2 +- .../ContainerSuperStockReplenisher.java | 5 ----- .../tile/TileSuperStockReplenisher.java | 22 +++++++++---------- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java b/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java index 15ecab4d9..2af8baee4 100644 --- a/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java @@ -146,7 +146,7 @@ protected void actionPerformed(final GuiButton btn) { boolean newMode = !containerSuperStockReplenisher.isFullStockMode(); this.containerSuperStockReplenisher.setFullStockMode(newMode); StockModeButton.set(newMode ? "fullstockMode" : "normalMode"); - this.containerSuperStockReplenisher.forceUpdate(); + this.flushPendingSync(); } super.actionPerformed(btn); } diff --git a/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java b/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java index ad01bf178..54f6e52f1 100644 --- a/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java @@ -171,11 +171,6 @@ public TileSuperStockReplenisher getTile() { return this.tile; } - public void forceUpdate() { - this.lastUpdated = 21; - this.detectAndSendChanges(); - } - public boolean isFullStockMode() { return this.fullStockModeSync.get(); } diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index 9d831e9ea..d072e32b7 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -432,7 +432,7 @@ public boolean canExtractItem(int slotIndex, ItemStack itemStackIn, int side) { } public void notifyNeighbors() { - if (this != null && this.getWorldObj() != null) { + if (this.getWorldObj() != null) { this.markDirty(); this.getWorldObj().notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); this.getWorldObj().markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); @@ -738,19 +738,19 @@ public IAEStackInventory getAEInventoryByName(StorageName name) { }; } - @Override - public Packet getDescriptionPacket() { + // @Override + // public Packet getDescriptionPacket() { - NBTTagCompound tag = new NBTTagCompound(); + // NBTTagCompound tag = new NBTTagCompound(); - this.writeToNBT(tag); + // this.writeToNBT(tag); - return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag); - } + // return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag); + // } - @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + // @Override + // public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { - this.readFromNBT(pkt.func_148857_g()); - } + // this.readFromNBT(pkt.func_148857_g()); + // } } From ec7afc6075e656327dc4957ea0965ad64b1b8b3c Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Thu, 18 Jun 2026 14:02:12 -0400 Subject: [PATCH 23/27] Resolve conversation: client TE and server TE synchronization --- .../client/gui/GuiSuperStockReplenisher.java | 2 ++ .../ContainerSuperStockReplenisher.java | 19 +++++++++++++++--- .../tile/TileSuperStockReplenisher.java | 20 +++++++++---------- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java b/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java index 2af8baee4..7f607836f 100644 --- a/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java @@ -146,6 +146,8 @@ protected void actionPerformed(final GuiButton btn) { boolean newMode = !containerSuperStockReplenisher.isFullStockMode(); this.containerSuperStockReplenisher.setFullStockMode(newMode); StockModeButton.set(newMode ? "fullstockMode" : "normalMode"); + + this.containerSuperStockReplenisher.markDirty(); this.flushPendingSync(); } super.actionPerformed(btn); diff --git a/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java b/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java index 54f6e52f1..120103d6a 100644 --- a/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java @@ -11,6 +11,7 @@ import net.minecraft.item.ItemStack; import com.glodblock.github.FluidCraft; +import com.glodblock.github.client.gui.GuiFCImgButton; import com.glodblock.github.common.item.FCBaseItemCell; import com.glodblock.github.common.tile.TileSuperStockReplenisher; import com.glodblock.github.inventory.gui.GuiType; @@ -32,6 +33,8 @@ import appeng.tile.inventory.IAEStackInventory; import appeng.util.Platform; import appeng.util.item.AEItemStack; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class ContainerSuperStockReplenisher extends AEBaseContainer implements IVirtualSlotSource { @@ -45,7 +48,10 @@ public class ContainerSuperStockReplenisher extends AEBaseContainer implements I private final IAEStackInventory configItems; public final AEStackInventorySyncHandler configItemsSlots; - private final BooleanSyncHandler fullStockModeSync; + public final BooleanSyncHandler fullStockModeSync; + + @SideOnly(Side.CLIENT) + private GuiFCImgButton StockModeButton; public ContainerSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockReplenisher tile) { super(ipl, tile); @@ -57,8 +63,11 @@ public ContainerSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockRepleni final SyncManager sm = this.getSyncManager(); this.configFluidsSlots = sm.root().aeStackInventory("fluidConfig", this.configFluids); this.configItemsSlots = sm.root().aeStackInventory("itemConfig", this.configItems); - this.fullStockModeSync = sm.root().booleanSync("fullstockMode").onClientChange((oldValue, newValue) -> {}) - .onServerChange((oldValue, newValue) -> this.tile.setFullStockMode(newValue)); + this.fullStockModeSync = sm.root().booleanSync("fullstockMode").onClientChange((oldValue, newValue) -> { + if (this.StockModeButton != null) { + this.StockModeButton.set(newValue ? "fullstockMode" : "normalMode"); + } + }).onServerChange((oldValue, newValue) -> this.tile.setFullStockMode(newValue)); this.addSlotToContainer( new SlotRestrictedInput( @@ -178,4 +187,8 @@ public boolean isFullStockMode() { public void setFullStockMode(final boolean fullStockMode) { this.fullStockModeSync.set(fullStockMode); } + + public void markDirty() { + this.fullStockModeSync.markDirty(); + } } diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index d072e32b7..2b1967fed 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -738,19 +738,19 @@ public IAEStackInventory getAEInventoryByName(StorageName name) { }; } - // @Override - // public Packet getDescriptionPacket() { + @Override + public Packet getDescriptionPacket() { - // NBTTagCompound tag = new NBTTagCompound(); + NBTTagCompound tag = new NBTTagCompound(); - // this.writeToNBT(tag); + this.writeToNBT(tag); - // return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag); - // } + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag); + } - // @Override - // public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { - // this.readFromNBT(pkt.func_148857_g()); - // } + this.readFromNBT(pkt.func_148857_g()); + } } From 37673c2dc8c4680147c60406053acd803a1ec9ae Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Thu, 18 Jun 2026 14:17:38 -0400 Subject: [PATCH 24/27] Resolved conversation: removed `postEvent()` in `setSlotsAccessible()` --- .../github/common/tile/TileSuperStockReplenisher.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index 2b1967fed..5b796c443 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -36,7 +36,6 @@ import appeng.api.networking.events.MENetworkBootingStatusChange; import appeng.api.networking.events.MENetworkEventSubscribe; import appeng.api.networking.events.MENetworkPowerStatusChange; -import appeng.api.networking.events.MENetworkStorageEvent; import appeng.api.networking.security.BaseActionSource; import appeng.api.networking.security.MachineSource; import appeng.api.networking.ticking.IGridTickable; @@ -341,14 +340,6 @@ public void setSlotsAccessible() { this.isSlotsAccessible = true; } - - try { - this.getProxy().getGrid().postEvent( - new MENetworkStorageEvent( - this.getProxy().getStorage().getItemInventory(), - this.invItems.getMEInventory().getStackType())); - } catch (GridAccessException ignored) {} - } public void checkSlotsAccessible() { From e5f64b88499167d9f320d04546479856d9b219b9 Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Thu, 18 Jun 2026 15:47:30 -0400 Subject: [PATCH 25/27] Resolve conversation: `onClientChange()` updated --- .../container/ContainerSuperStockReplenisher.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java b/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java index 120103d6a..ad93adc05 100644 --- a/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java @@ -11,7 +11,6 @@ import net.minecraft.item.ItemStack; import com.glodblock.github.FluidCraft; -import com.glodblock.github.client.gui.GuiFCImgButton; import com.glodblock.github.common.item.FCBaseItemCell; import com.glodblock.github.common.tile.TileSuperStockReplenisher; import com.glodblock.github.inventory.gui.GuiType; @@ -33,8 +32,6 @@ import appeng.tile.inventory.IAEStackInventory; import appeng.util.Platform; import appeng.util.item.AEItemStack; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class ContainerSuperStockReplenisher extends AEBaseContainer implements IVirtualSlotSource { @@ -50,9 +47,6 @@ public class ContainerSuperStockReplenisher extends AEBaseContainer implements I public final BooleanSyncHandler fullStockModeSync; - @SideOnly(Side.CLIENT) - private GuiFCImgButton StockModeButton; - public ContainerSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockReplenisher tile) { super(ipl, tile); this.tile = tile; @@ -63,11 +57,9 @@ public ContainerSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockRepleni final SyncManager sm = this.getSyncManager(); this.configFluidsSlots = sm.root().aeStackInventory("fluidConfig", this.configFluids); this.configItemsSlots = sm.root().aeStackInventory("itemConfig", this.configItems); - this.fullStockModeSync = sm.root().booleanSync("fullstockMode").onClientChange((oldValue, newValue) -> { - if (this.StockModeButton != null) { - this.StockModeButton.set(newValue ? "fullstockMode" : "normalMode"); - } - }).onServerChange((oldValue, newValue) -> this.tile.setFullStockMode(newValue)); + this.fullStockModeSync = sm.root().booleanSync("fullstockMode") + .onClientChange((oldValue, newValue) -> this.setFullStockMode(newValue)) + .onServerChange((oldValue, newValue) -> this.tile.setFullStockMode(newValue)); this.addSlotToContainer( new SlotRestrictedInput( From 55fd5a1509bb52ec4704ca6ffc63519eb34cdcb6 Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Sun, 21 Jun 2026 14:24:53 -0400 Subject: [PATCH 26/27] Resolve conversation: complete implementation of SyncHandler functionality to get rid of server/client packet code --- .../client/gui/GuiSuperStockReplenisher.java | 5 ++--- .../ContainerSuperStockReplenisher.java | 19 ++++++++++++++++--- .../tile/TileSuperStockReplenisher.java | 19 ------------------- 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java b/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java index 7f607836f..ad8f67478 100644 --- a/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/client/gui/GuiSuperStockReplenisher.java @@ -55,9 +55,9 @@ public void initGui() { guiLeft - 18, guiTop + 8, "stock mode button", - this.tileSuperStockReplenisher.isFullStockMode() ? "fullstockMode" : "normalMode", + this.containerSuperStockReplenisher.isFullStockMode() ? "fullstockMode" : "normalMode", true); - + this.containerSuperStockReplenisher.setModeButton(this.StockModeButton); buttonList.add(this.StockModeButton); this.initSlots(); } @@ -147,7 +147,6 @@ protected void actionPerformed(final GuiButton btn) { this.containerSuperStockReplenisher.setFullStockMode(newMode); StockModeButton.set(newMode ? "fullstockMode" : "normalMode"); - this.containerSuperStockReplenisher.markDirty(); this.flushPendingSync(); } super.actionPerformed(btn); diff --git a/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java b/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java index ad93adc05..d5809fc24 100644 --- a/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/client/gui/container/ContainerSuperStockReplenisher.java @@ -11,6 +11,7 @@ import net.minecraft.item.ItemStack; import com.glodblock.github.FluidCraft; +import com.glodblock.github.client.gui.GuiFCImgButton; import com.glodblock.github.common.item.FCBaseItemCell; import com.glodblock.github.common.tile.TileSuperStockReplenisher; import com.glodblock.github.inventory.gui.GuiType; @@ -32,6 +33,8 @@ import appeng.tile.inventory.IAEStackInventory; import appeng.util.Platform; import appeng.util.item.AEItemStack; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class ContainerSuperStockReplenisher extends AEBaseContainer implements IVirtualSlotSource { @@ -47,6 +50,9 @@ public class ContainerSuperStockReplenisher extends AEBaseContainer implements I public final BooleanSyncHandler fullStockModeSync; + @SideOnly(Side.CLIENT) + private GuiFCImgButton modeButton; + public ContainerSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockReplenisher tile) { super(ipl, tile); this.tile = tile; @@ -57,9 +63,11 @@ public ContainerSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockRepleni final SyncManager sm = this.getSyncManager(); this.configFluidsSlots = sm.root().aeStackInventory("fluidConfig", this.configFluids); this.configItemsSlots = sm.root().aeStackInventory("itemConfig", this.configItems); - this.fullStockModeSync = sm.root().booleanSync("fullstockMode") - .onClientChange((oldValue, newValue) -> this.setFullStockMode(newValue)) - .onServerChange((oldValue, newValue) -> this.tile.setFullStockMode(newValue)); + this.fullStockModeSync = sm.root().booleanSync("fullstockMode").onClientChange((oldValue, newValue) -> { + if (this.modeButton != null) { + this.modeButton.set(newValue ? "fullstockMode" : "normalMode"); + } + }).onServerChange((oldValue, newValue) -> this.tile.setFullStockMode(newValue)); this.addSlotToContainer( new SlotRestrictedInput( @@ -73,6 +81,11 @@ public ContainerSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockRepleni bindPlayerInventory(ipl, 0, 251 - 82); } + @SideOnly(Side.CLIENT) + public void setModeButton(GuiFCImgButton button) { + this.modeButton = button; + } + @Override public ItemStack slotClick(int slotId, int clickedButton, int mode, EntityPlayer player) { if (slotId == 0 && player.inventory.getItemStack() == null && isConfigurated()) return null; diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index 5b796c443..cc54fbe11 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -8,9 +8,6 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; @@ -728,20 +725,4 @@ public IAEStackInventory getAEInventoryByName(StorageName name) { default -> null; }; } - - @Override - public Packet getDescriptionPacket() { - - NBTTagCompound tag = new NBTTagCompound(); - - this.writeToNBT(tag); - - return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag); - } - - @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { - - this.readFromNBT(pkt.func_148857_g()); - } } From 6749872583c60ddd16a277baee6c2ef2b8ecf4d6 Mon Sep 17 00:00:00 2001 From: Inphysible <103602207+Inphysible@users.noreply.github.com> Date: Mon, 22 Jun 2026 15:21:44 -0400 Subject: [PATCH 27/27] Resolve conversation: remove useless code --- .../glodblock/github/common/tile/TileSuperStockReplenisher.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java index cc54fbe11..a018a0850 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java +++ b/src/main/java/com/glodblock/github/common/tile/TileSuperStockReplenisher.java @@ -423,7 +423,6 @@ public void notifyNeighbors() { if (this.getWorldObj() != null) { this.markDirty(); this.getWorldObj().notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.getWorldObj().markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); } }