SmithsGaming / Armory

Minecraft Mod named Armory, adds the Armors world to Minecraft
GNU Lesser General Public License v3.0
3 stars 1 forks source link

Shift click in containers #5

Closed Tim020 closed 9 years ago

Tim020 commented 9 years ago

@Override public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) { ItemStack newItemStack = null; Slot slot = (Slot) inventorySlots.get(slotIndex);

    if (slot != null && slot.getHasStack()) {
        ItemStack itemStack = slot.getStack();
        newItemStack = itemStack.copy();

        if (slotIndex < chestInventoryRows * chestInventoryColumns) {
            if (!this.mergeItemStack(itemStack, chestInventoryRows * chestInventoryColumns, inventorySlots.size(), false)) {
                return null;
            }
        } else if (!this.mergeItemStack(itemStack, 0, chestInventoryRows * chestInventoryColumns, false)) {
            return null;
        }

        if (itemStack.stackSize == 0) {
            slot.putStack(null);
        } else {
            slot.onSlotChanged();
        }
    }

    return newItemStack;
}