Skip to content

Commit

Permalink
Add shift clicking to chisel GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
tterrag1098 committed Jan 8, 2015
1 parent 58270a4 commit fdb8cb7
Showing 1 changed file with 45 additions and 2 deletions.
Expand Up @@ -88,8 +88,51 @@ public boolean canInteractWith(EntityPlayer entityplayer) {
}

@Override
public ItemStack transferStackInSlot(EntityPlayer entity, int i) {
return null;
public ItemStack transferStackInSlot(EntityPlayer entity, int slotIdx) {
ItemStack itemstack = null;
Slot slot = (Slot) this.inventorySlots.get(slotIdx);

if (slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();

if (slotIdx > 24) {
if (!this.mergeItemStack(itemstack1, 24, 25, false)) {
return null;
}
} else {
if (slotIdx < 24 && itemstack1 != null) {
entity.inventory.setItemStack(itemstack1.copy());
slot.onPickupFromSlot(entity, itemstack1);
itemstack1 = entity.inventory.getItemStack();
entity.inventory.setItemStack(null);
}

if (!this.mergeItemStack(itemstack1, 52, 61, false)) {
if (!this.mergeItemStack(itemstack1, 25, 52, false)) {
return null;
}
}
}
slot.onSlotChange(itemstack1, itemstack);

if (itemstack1.stackSize == 0) {
slot.putStack((ItemStack) null);
} else {
slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize) {
return null;
}
if (slotIdx >= 24) {
slot.onPickupFromSlot(entity, itemstack1);
}
if (itemstack1.stackSize == 0) {
slot.putStack(null);
return null;
}
}
return itemstack;
}

public void onChiselSlotChanged() {
Expand Down

0 comments on commit fdb8cb7

Please sign in to comment.