From 1c2d2815738a9ba94bb0c4ac53aae5aa96f00aa2 Mon Sep 17 00:00:00 2001 From: Raoul Van den Berge Date: Thu, 28 Jul 2016 15:20:48 +0200 Subject: [PATCH] Fixed usage of client side only class in ContainerBase, fixes #223 --- CHANGELOG.md | 1 + .../container/ContainerBase.java | 24 ++++--------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 491aac9df..13deedaee 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ **Bugfixes** - Fixed rendering crash with Disk Drive - Fixed crash when quickly toggling sorting direction in Grid +- Fixed not being able to clear configurations in GUIs ### 0.8.12 **Bugfixes** diff --git a/src/main/java/refinedstorage/container/ContainerBase.java b/src/main/java/refinedstorage/container/ContainerBase.java index 1b6be6c65..980a39526 100755 --- a/src/main/java/refinedstorage/container/ContainerBase.java +++ b/src/main/java/refinedstorage/container/ContainerBase.java @@ -1,6 +1,5 @@ package refinedstorage.container; -import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Container; @@ -48,23 +47,15 @@ public abstract class ContainerBase extends Container { if (slot instanceof SlotSpecimen) { if (((SlotSpecimen) slot).isWithSize()) { if (slot.getStack() != null) { - if (GuiScreen.isShiftKeyDown()) { + if (clickType == ClickType.QUICK_MOVE) { slot.putStack(null); } else { int amount = slot.getStack().stackSize; if (clickedButton == 0) { - amount--; - - if (amount < 1) { - amount = 1; - } + amount = Math.max(1, --amount); } else if (clickedButton == 1) { - amount++; - - if (amount > 64) { - amount = 64; - } + amount = Math.min(64, ++amount); } slot.getStack().stackSize = amount; @@ -72,14 +63,7 @@ public abstract class ContainerBase extends Container { } else if (player.inventory.getItemStack() != null) { int amount = player.inventory.getItemStack().stackSize; - if (clickedButton == 1) { - amount = 1; - } - - ItemStack toPut = player.inventory.getItemStack().copy(); - toPut.stackSize = amount; - - slot.putStack(toPut); + slot.putStack(ItemHandlerHelper.copyStackWithSize(player.inventory.getItemStack(), clickedButton == 1 ? 1 : amount)); } } else if (player.inventory.getItemStack() == null) { slot.putStack(null);