0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

マイクラチュートリアル4-2 サイクロン堀 鉱石探索

Posted at
local args = {...}
local n = args[1]

local gold = "minecraft:gold_ore" --金
local iron = "minecraft:iron_ore" --鉄
local coal = "minecraft:coal_ore" --石炭
local redstone = "minecraft:redstone_ore" --レッドストーン
local lapis = "minecraft:lapis_ore" --ラピスラズリ
local diamond = "minecraft:diamond_ore" --ダイヤモンド

turtle.select(1)
turtle.refuel()

local count = 0

for i = 1, n do
  local result = turtle.digDown()
  if result == true then
    count = count + 1
  else
    break
  end
 turtle.down()

 for i = 1, 4 do
  local success, data = turtle.inspect()

  if data["name"] == gold or
     data["name"] == iron or
     data["name"] == coal or
     data["name"] == redstone or
     data["name"] == lapis or
     data["name"] == diamond then
    turtle.dig()
    turtle.forward()

    for i = 1, 4 do
      if data["name"] == gold or
       data["name"] == iron or
       data["name"] == coal or
       data["name"] == redstone or
       data["name"] == lapis or
       data["name"] == diamond then
       turtle.dig()
      end
      turtle.back()
    end
    turtle.back()
  end
  turtle.turnLeft()
  end
end

local up = count - 1

for n = 1, up do
  turtle.up()
end

for j = 1, 4 do
  turtle.place()
  turtle.turnLeft()
end

turtle.up()
turtle.placeDown()

for i = 1, 16 do
  turtle.select(i)
  turtle.drop()
end
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?