public void setItem(int i, ItemStack itemstack) { contents[i] = itemstack; if (itemstack != null && itemstack.count > getMaxStackSize()) { itemstack.count = getMaxStackSize(); } }