xp = peripheral.wrap("right") xp.setAutoCollect(true) local function dropAll() for i = 1, 16 do turtle.select(i) turtle.drop() end end while true do turtle.attackUp() sleep(0.1) turtle.suckUp() if xp.getLevels() >= 30 then dropAll() turtle.select(1) turtle.suck() xp.enchant(30) turtle.drop() end local free = false for i = 1, 16 do if turtle.getItemCount(i) == 0 then free = true break end end if not free then dropAll() end end