boolean success = playerView.canFitSome(slotStack);
ItemStack overflow = playerView.data.addItems(slotStack);
slot.putStack(overflow);
// Send slot contents to player if it doesn't match the calculated overflow.
((EntityPlayerMP)player).playerNetServerHandler.sendPacket(
new S2FPacketSetSlot(player.openContainer.windowId, slotId, overflow));
if (!success) return null;
}
return stackBefore;
}