Move the commands around.
Made sure InventoryUtil.doesBlockHaveInventory was used where it should
be, it will slightly increase performance.