Skip to content

Instantly share code, notes, and snippets.

@Unh0lyTigg
Created May 21, 2014 09:26
Show Gist options
  • Save Unh0lyTigg/a8ec4eedca824ef3a1ab to your computer and use it in GitHub Desktop.
Save Unh0lyTigg/a8ec4eedca824ef3a1ab to your computer and use it in GitHub Desktop.
Container.transferStackInSlot(EntityPlayer, int)
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
ItemStack itemstack = null;
Slot slot = (Slot)this.inventorySlots.get(par2);
if (slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if (par2 < this.tile.getSizeInventory())
if (!this.mergeItemStack(itemstack1, this.tile.getSizeInventory(), this.inventorySlots.size(), true))
return null;
else if (!this.mergeItemStack(itemstack1, 0, this.tile.getSizeInventory(), false))
return null;
if (itemstack1.stackSize == 0)
slot.putStack((ItemStack)null);
else
slot.onSlotChanged();
}
return itemstack;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment