ItemStack stack = repairer.getStackInSlot(0);
if (stack == null) {
ItemStack playerStack = par5EntityPlayer.getCurrentEquippedItem();
if (repairer.canInsertItem(0, playerStack, 1)) {
repairer.setInventorySlotContents(0, playerStack.splitStack(1));
if (playerStack.stackSize <= 0)
par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, null);
repairer.markDirty();