Added a custom implementation of Container#mergeItemStack() to prevent inserting invalid items into slots.

It's different by exactly 1 function call to Slot#isItemValid().  I renamed the variables in there to make it more readable, though.