Fixed Shift Click Duplication Bugs.

Closes https://github.com/Ellpeck/ActuallyAdditions/issues/10
This commit is contained in:
Ellpeck 2015-08-28 15:41:12 +02:00
parent 1f9ce8cc77
commit 36d3d7f79f
4 changed files with 9 additions and 8 deletions

View file

@ -54,7 +54,7 @@ public class ContainerBreaker extends Container{
//Other Slots in Inventory excluded //Other Slots in Inventory excluded
if(slot >= inventoryStart){ if(slot >= inventoryStart){
//Shift from Inventory //Shift from Inventory
if(!this.mergeItemStack(newStack, 0, 10, false)){ if(!this.mergeItemStack(newStack, 0, 9, false)){
// //
if(slot >= inventoryStart && slot <= inventoryEnd){ if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;

View file

@ -54,7 +54,7 @@ public class ContainerDropper extends Container{
//Other Slots in Inventory excluded //Other Slots in Inventory excluded
if(slot >= inventoryStart){ if(slot >= inventoryStart){
//Shift from Inventory //Shift from Inventory
if(!this.mergeItemStack(newStack, 0, 10, false)){ if(!this.mergeItemStack(newStack, 0, 9, false)){
// //
if(slot >= inventoryStart && slot <= inventoryEnd){ if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;

View file

@ -59,7 +59,7 @@ public class ContainerGrinder extends Container{
ItemStack currentStack = newStack.copy(); ItemStack currentStack = newStack.copy();
//Slots in Inventory to shift from //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; if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null;
theSlot.onSlotChange(newStack, currentStack); theSlot.onSlotChange(newStack, currentStack);
} }
@ -68,9 +68,10 @@ public class ContainerGrinder extends Container{
//Shift from Inventory //Shift from Inventory
if(CrusherRecipeManualRegistry.getOutput(newStack, false) != null){ if(CrusherRecipeManualRegistry.getOutput(newStack, false) != null){
if(!this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_1, TileEntityGrinder.SLOT_INPUT_1+1, false)){ 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; if(!this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_2, TileEntityGrinder.SLOT_INPUT_2+1, false)) return null;
} }
else return null;
} }
} }
// //

View file

@ -47,14 +47,14 @@ public class ContainerPhantomPlacer extends Container{
Slot theSlot = (Slot)this.inventorySlots.get(slot); Slot theSlot = (Slot)this.inventorySlots.get(slot);
if (theSlot != null && theSlot.getHasStack()){ if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack(); ItemStack newStack = theSlot.getStack();
ItemStack currentStack = newStack.copy(); ItemStack currentStack = newStack.copy();
//Other Slots in Inventory excluded //Other Slots in Inventory excluded
if(slot >= inventoryStart){ if(slot >= inventoryStart){
//Shift from Inventory //Shift from Inventory
if(!this.mergeItemStack(newStack, 0, 10, false)){ if(!this.mergeItemStack(newStack, 0, 9, false)){
// //
if(slot >= inventoryStart && slot <= inventoryEnd){ if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; 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; 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(); else theSlot.onSlotChanged();
if (newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize) return null;
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;