Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NBT don't save, Bulk100 mode #1681

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion common/logisticspipes/gui/GuiChassisPipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

Expand Down
13 changes: 13 additions & 0 deletions common/logisticspipes/gui/GuiFirewall.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions common/logisticspipes/gui/GuiFluidSupplierMk2Pipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
}
6 changes: 6 additions & 0 deletions common/logisticspipes/gui/GuiFluidSupplierPipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
}
10 changes: 10 additions & 0 deletions common/logisticspipes/gui/GuiInvSysConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
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;
import org.lwjgl.opengl.GL11;

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;
Expand Down Expand Up @@ -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)) {
Expand Down
7 changes: 7 additions & 0 deletions common/logisticspipes/gui/GuiLogisticsCraftingTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions common/logisticspipes/gui/GuiSatellitePipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions common/logisticspipes/modules/ModuleActiveSupplier.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 1 addition & 2 deletions common/logisticspipes/ticks/VersionChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ public VersionInfo call() throws Exception {
}

/**
* Integration with Version Checker
* (http://www.minecraftforum.net/topic/2721902-/)
* Integration with <a href="http://www.minecraftforum.net/topic/2721902-/">Version Checker</a>
*/
private void sendIMCOutdatedMessage(VersionInfo versionInfo) {
if (Loader.isModLoaded("VersionChecker")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}