public int setItemStackSize ( int stackSize ) { if ( itemStack . isEmpty ( ) ) return 0 ; int start = itemStack . getCount ( ) ; itemStack . setCount ( Math . min ( stackSize , Math . min ( itemStack . getMaxStackSize ( ) , getSlotStackLimit ( ) ) ) ) ; return itemStack . getCount ( ) - start ; }
Sets the item stack size .