diff --git a/common/logisticspipes/gui/GuiChassisPipe.java b/common/logisticspipes/gui/GuiChassisPipe.java index d0ab6d48f..dc914458b 100644 --- a/common/logisticspipes/gui/GuiChassisPipe.java +++ b/common/logisticspipes/gui/GuiChassisPipe.java @@ -15,6 +15,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; import logisticspipes.config.Configs; import logisticspipes.items.ItemModule; @@ -117,7 +118,10 @@ private void updateModuleConfigButtonVisibility(int slot) { @Override public void onGuiClosed() { - MainProxy.sendPacketToServer(PacketHandler.getPacket(GuiClosePacket.class).setTilePos(_chassiPipe.container)); + final TileEntity container = _chassiPipe.getContainer(); + if (container != null) { + MainProxy.sendPacketToServer(PacketHandler.getPacket(GuiClosePacket.class).setTilePos(container)); + } super.onGuiClosed(); } diff --git a/common/logisticspipes/gui/GuiFirewall.java b/common/logisticspipes/gui/GuiFirewall.java index faf2ea94e..fda652290 100644 --- a/common/logisticspipes/gui/GuiFirewall.java +++ b/common/logisticspipes/gui/GuiFirewall.java @@ -2,8 +2,12 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import logisticspipes.network.PacketHandler; +import logisticspipes.network.packets.gui.GuiClosePacket; import logisticspipes.pipes.PipeItemsFirewall; +import logisticspipes.proxy.MainProxy; import logisticspipes.utils.gui.DummyContainer; import logisticspipes.utils.gui.GuiGraphics; import logisticspipes.utils.gui.GuiStringHandlerButton; @@ -65,6 +69,15 @@ protected void actionPerformed(GuiButton button) { } } + @Override + public void onGuiClosed() { + final TileEntity container = pipe.getContainer(); + if (container != null) { + MainProxy.sendPacketToServer(PacketHandler.getPacket(GuiClosePacket.class).setTilePos(container)); + } + super.onGuiClosed(); + } + @Override protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) { GuiGraphics.drawGuiBackGround(mc, guiLeft, guiTop, right, bottom, zLevel, true); diff --git a/common/logisticspipes/gui/GuiFluidSupplierMk2Pipe.java b/common/logisticspipes/gui/GuiFluidSupplierMk2Pipe.java index 64b0f54c6..f87ec6e65 100644 --- a/common/logisticspipes/gui/GuiFluidSupplierMk2Pipe.java +++ b/common/logisticspipes/gui/GuiFluidSupplierMk2Pipe.java @@ -10,8 +10,10 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.inventory.IInventory; +import net.minecraft.tileentity.TileEntity; import logisticspipes.network.PacketHandler; +import logisticspipes.network.packets.gui.GuiClosePacket; import logisticspipes.network.packets.pipe.FluidSupplierAmount; import logisticspipes.network.packets.pipe.FluidSupplierMinMode; import logisticspipes.network.packets.pipe.FluidSupplierMode; @@ -114,6 +116,10 @@ protected void actionPerformed(GuiButton guibutton) throws IOException { @Override public void onGuiClosed() { + final TileEntity container = logic.getContainer(); + if (container != null) { + MainProxy.sendPacketToServer(PacketHandler.getPacket(GuiClosePacket.class).setTilePos(container)); + } super.onGuiClosed(); } } diff --git a/common/logisticspipes/gui/GuiFluidSupplierPipe.java b/common/logisticspipes/gui/GuiFluidSupplierPipe.java index a2b3fb5e3..1529d58e4 100644 --- a/common/logisticspipes/gui/GuiFluidSupplierPipe.java +++ b/common/logisticspipes/gui/GuiFluidSupplierPipe.java @@ -10,11 +10,13 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.inventory.IInventory; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import logisticspipes.network.PacketHandler; +import logisticspipes.network.packets.gui.GuiClosePacket; import logisticspipes.network.packets.pipe.FluidSupplierMode; import logisticspipes.pipes.PipeItemsFluidSupplier; import logisticspipes.proxy.MainProxy; @@ -88,6 +90,10 @@ protected void actionPerformed(GuiButton guibutton) throws IOException { @Override public void onGuiClosed() { + final TileEntity container = logic.getContainer(); + if (container != null) { + MainProxy.sendPacketToServer(PacketHandler.getPacket(GuiClosePacket.class).setTilePos(container)); + } super.onGuiClosed(); } } diff --git a/common/logisticspipes/gui/GuiInvSysConnector.java b/common/logisticspipes/gui/GuiInvSysConnector.java index dc6d6aa8e..22b9ac762 100644 --- a/common/logisticspipes/gui/GuiInvSysConnector.java +++ b/common/logisticspipes/gui/GuiInvSysConnector.java @@ -8,6 +8,7 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -15,6 +16,7 @@ import logisticspipes.interfaces.IGUIChannelInformationReceiver; import logisticspipes.network.PacketHandler; +import logisticspipes.network.packets.gui.GuiClosePacket; import logisticspipes.network.packets.pipe.InvSysConContentRequest; import logisticspipes.network.packets.pipe.InvSysConOpenSelectChannelPopupPacket; import logisticspipes.network.packets.pipe.InvSysConResistance; @@ -185,6 +187,14 @@ protected void actionPerformed(GuiButton button) throws IOException { } } + @Override + public void onGuiClosed() { + final TileEntity container = pipe.getContainer(); + if (container != null) { + MainProxy.sendPacketToServer(PacketHandler.getPacket(GuiClosePacket.class).setTilePos(container)); + } super.onGuiClosed(); + } + @Override protected void mouseClicked(int x, int y, int k) throws IOException { if (!resistanceCountBar.handleClick(x, y, k)) { diff --git a/common/logisticspipes/gui/GuiLogisticsCraftingTable.java b/common/logisticspipes/gui/GuiLogisticsCraftingTable.java index 530a72336..dfc1dc8d5 100644 --- a/common/logisticspipes/gui/GuiLogisticsCraftingTable.java +++ b/common/logisticspipes/gui/GuiLogisticsCraftingTable.java @@ -10,6 +10,7 @@ import logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity; import logisticspipes.network.PacketHandler; import logisticspipes.network.packets.block.CraftingCycleRecipe; +import logisticspipes.network.packets.gui.GuiClosePacket; import logisticspipes.proxy.MainProxy; import logisticspipes.utils.gui.DummyContainer; import logisticspipes.utils.gui.GuiGraphics; @@ -109,6 +110,12 @@ protected void actionPerformed(GuiButton button) { } } + @Override + public void onGuiClosed() { + MainProxy.sendPacketToServer(PacketHandler.getPacket(GuiClosePacket.class).setTilePos(_crafter)); + super.onGuiClosed(); + } + private boolean isMouseInFuzzyPanel(int mx, int my) { if (fuzzyPanelSelection == -1) { return false; diff --git a/common/logisticspipes/gui/GuiSatellitePipe.java b/common/logisticspipes/gui/GuiSatellitePipe.java index de90fe4d8..3fdfcb8e2 100644 --- a/common/logisticspipes/gui/GuiSatellitePipe.java +++ b/common/logisticspipes/gui/GuiSatellitePipe.java @@ -18,6 +18,7 @@ import org.lwjgl.input.Keyboard; import logisticspipes.network.PacketHandler; +import logisticspipes.network.packets.gui.GuiClosePacket; import logisticspipes.network.packets.satpipe.SatelliteSetNamePacket; import logisticspipes.pipes.SatelliteNamingResult; import logisticspipes.proxy.MainProxy; @@ -62,6 +63,10 @@ public void initGui() { @Override public void closeGui() throws IOException { + final TileEntity container = satellitePipe.getContainer(); + if (container != null) { + MainProxy.sendPacketToServer(PacketHandler.getPacket(GuiClosePacket.class).setTilePos(container)); + } super.closeGui(); Keyboard.enableRepeatEvents(false); } diff --git a/common/logisticspipes/modules/ModuleActiveSupplier.java b/common/logisticspipes/modules/ModuleActiveSupplier.java index 2278dd797..b628b0cbc 100644 --- a/common/logisticspipes/modules/ModuleActiveSupplier.java +++ b/common/logisticspipes/modules/ModuleActiveSupplier.java @@ -246,7 +246,7 @@ private void createPatternRequest(IInventoryUtil invUtil) { haveCount = have.getStackSize(); } if ((patternMode.getValue() == PatternMode.Bulk50 && haveCount > needed.getStackSize() / 2) || ( - patternMode.getValue() == PatternMode.Bulk100 && haveCount >= needed.getStackSize())) { + patternMode.getValue() == PatternMode.Bulk100 && haveCount > 0)) { continue; } @@ -337,7 +337,7 @@ private void createSupplyRequest(IInventoryUtil invUtil) { } if (spaceAvailable < 1 || (requestMode.getValue() == SupplyMode.Bulk50 && haveCount > item.getValue() / 2) - || (requestMode.getValue() == SupplyMode.Bulk100 && haveCount >= item.getValue())) { + || (requestMode.getValue() == SupplyMode.Bulk100 && haveCount > 1)) { item.setValue(0); continue; } diff --git a/common/logisticspipes/ticks/VersionChecker.java b/common/logisticspipes/ticks/VersionChecker.java index 3930fabc9..757a8159d 100644 --- a/common/logisticspipes/ticks/VersionChecker.java +++ b/common/logisticspipes/ticks/VersionChecker.java @@ -157,8 +157,7 @@ public VersionInfo call() throws Exception { } /** - * Integration with Version Checker - * (http://www.minecraftforum.net/topic/2721902-/) + * Integration with Version Checker */ private void sendIMCOutdatedMessage(VersionInfo versionInfo) { if (Loader.isModLoaded("VersionChecker")) { diff --git a/src/main/kotlin/network/rs485/logisticspipes/compat/BarrelInventoryHandler.kt b/src/main/kotlin/network/rs485/logisticspipes/compat/BarrelInventoryHandler.kt index 7154db6cf..cbfc841d7 100644 --- a/src/main/kotlin/network/rs485/logisticspipes/compat/BarrelInventoryHandler.kt +++ b/src/main/kotlin/network/rs485/logisticspipes/compat/BarrelInventoryHandler.kt @@ -155,4 +155,4 @@ class BarrelInventoryHandler(val tile: IBarrel, val mode: ProviderMode) : Specia * Returns the ItemIdentifier from the getItem method. */ private fun getIdentifier(): ItemIdentifier = ItemIdentifier.get(getItem()) -} \ No newline at end of file +}