From 36d3d7f79f0d05423a124806983e3d67d4981350 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 28 Aug 2015 15:41:12 +0200 Subject: [PATCH] Fixed Shift Click Duplication Bugs. Closes https://github.com/Ellpeck/ActuallyAdditions/issues/10 --- .../actuallyadditions/inventory/ContainerBreaker.java | 2 +- .../actuallyadditions/inventory/ContainerDropper.java | 2 +- .../actuallyadditions/inventory/ContainerGrinder.java | 5 +++-- .../inventory/ContainerPhantomPlacer.java | 8 ++++---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerBreaker.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerBreaker.java index 91b4a954b..c994607e7 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerBreaker.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerBreaker.java @@ -54,7 +54,7 @@ public class ContainerBreaker extends Container{ //Other Slots in Inventory excluded if(slot >= inventoryStart){ //Shift from Inventory - if(!this.mergeItemStack(newStack, 0, 10, false)){ + if(!this.mergeItemStack(newStack, 0, 9, false)){ // if(slot >= inventoryStart && slot <= inventoryEnd){ if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDropper.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDropper.java index 60b80d628..d395a2582 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDropper.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerDropper.java @@ -54,7 +54,7 @@ public class ContainerDropper extends Container{ //Other Slots in Inventory excluded if(slot >= inventoryStart){ //Shift from Inventory - if(!this.mergeItemStack(newStack, 0, 10, false)){ + if(!this.mergeItemStack(newStack, 0, 9, false)){ // if(slot >= inventoryStart && slot <= inventoryEnd){ if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java index 763a48c96..95e7653b7 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerGrinder.java @@ -59,7 +59,7 @@ public class ContainerGrinder extends Container{ ItemStack currentStack = newStack.copy(); //Slots in Inventory to shift from - if(slot == TileEntityGrinder.SLOT_OUTPUT_1_1 || slot == TileEntityGrinder.SLOT_OUTPUT_1_2 || slot == TileEntityGrinder.SLOT_OUTPUT_2_1 || slot == TileEntityGrinder.SLOT_OUTPUT_2_2){ + if(slot == TileEntityGrinder.SLOT_OUTPUT_1_1 || slot == TileEntityGrinder.SLOT_OUTPUT_1_2 || (this.isDouble && (slot == TileEntityGrinder.SLOT_OUTPUT_2_1 || slot == TileEntityGrinder.SLOT_OUTPUT_2_2))){ if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null; theSlot.onSlotChange(newStack, currentStack); } @@ -68,9 +68,10 @@ public class ContainerGrinder extends Container{ //Shift from Inventory if(CrusherRecipeManualRegistry.getOutput(newStack, false) != null){ if(!this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_1, TileEntityGrinder.SLOT_INPUT_1+1, false)){ - if(this.tileGrinder.isDouble){ + if(this.isDouble){ if(!this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_2, TileEntityGrinder.SLOT_INPUT_2+1, false)) return null; } + else return null; } } // diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerPhantomPlacer.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerPhantomPlacer.java index 27d36ab58..2225508cb 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerPhantomPlacer.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerPhantomPlacer.java @@ -47,14 +47,14 @@ public class ContainerPhantomPlacer extends Container{ Slot theSlot = (Slot)this.inventorySlots.get(slot); - if (theSlot != null && theSlot.getHasStack()){ + if(theSlot != null && theSlot.getHasStack()){ ItemStack newStack = theSlot.getStack(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded if(slot >= inventoryStart){ //Shift from Inventory - if(!this.mergeItemStack(newStack, 0, 10, false)){ + if(!this.mergeItemStack(newStack, 0, 9, false)){ // if(slot >= inventoryStart && slot <= inventoryEnd){ if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; @@ -65,10 +65,10 @@ public class ContainerPhantomPlacer extends Container{ } else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; - if (newStack.stackSize == 0) theSlot.putStack(null); + if(newStack.stackSize == 0) theSlot.putStack(null); else theSlot.onSlotChanged(); - if (newStack.stackSize == currentStack.stackSize) return null; + if(newStack.stackSize == currentStack.stackSize) return null; theSlot.onPickupFromSlot(player, newStack); return currentStack;