Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local chestFrequency = 10
- local drahokamy = {
- "minecraft:diamond",
- "minecraft:emerald",
- "minecraft:redstone",
- "minecraft:lapis_lazuli",
- "minecraft:gold_ore",
- "minecraft:iron_ore"
- }
- local function tableContains(table, element)
- for _, value in pairs(table) do
- if value == element then
- return true
- end
- end
- return false
- end
- local function dig()
- turtle.dig()
- turtle.digUp()
- turtle.digDown()
- end
- local function forward()
- while not turtle.forward() do
- turtle.dig()
- turtle.attack()
- end
- end
- local function emptyInventory()
- for i = 1, 16 do
- turtle.select(i)
- local item = turtle.getItemDetail()
- if item and not tableContains(drahokamy, item.name) then
- turtle.drop()
- end
- end
- end
- local function findChestAndEmptyInventory()
- local chestFound = false
- for i = 1, 4 do
- turtle.turnLeft()
- local success, data = turtle.inspect()
- if success and data.name == "minecraft:chest" then
- chestFound = true
- break
- end
- end
- if chestFound then
- emptyInventory()
- end
- end
- local function refuel()
- for i = 1, 16 do
- local fuelLevel = turtle.getFuelLevel()
- if fuelLevel < 500 then
- turtle.select(i)
- turtle.refuel(1)
- end
- end
- turtle.select(1)
- end
- local function mine(steps)
- for step = 1, steps do
- dig()
- forward()
- if step % chestFrequency == 0 then
- findChestAndEmptyInventory()
- refuel()
- print("Natěženo:")
- for i = 1, 16 do
- turtle.select(i)
- local item = turtle.getItemDetail()
- if item then
- print(item.name .. ": " .. item.count)
- end
- end
- turtle.select(1)
- end
- end
- end
- mine(100) -- Vložte počet kroků pro těžbu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement