Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.openTab("shell")
- STONE_SLOT = 1
- MC_STACK_DEFAULT_SIZE= 64
- local function _turnToCardinalDirection(direction)
- while peripheral.find("NBT_Observer").read_state().facing ~= direction do
- turtle.turnRight()
- end
- end
- function faceNorth()
- _turnToCardinalDirection("north")
- end
- function faceEast()
- _turnToCardinalDirection("east")
- end
- function faceSouth()
- _turnToCardinalDirection("south")
- end
- function faceWest()
- _turnToCardinalDirection("west")
- end
- function _emptySlot(slot)
- turtle.select(slot)
- turtle.drop()
- end
- function fillStone()
- turnToStoneChest()
- turtle.select(STONE_SLOT)
- turtle.suck(MC_STACK_DEFAULT_SIZE - (turtle.getItemDetail(STONE_SLOT) and turtle.getItemDetail(STONE_SLOT).count or 0))
- end
- function dropInvOres()
- turnToOreChest()
- for slot=2, 16 do
- _emptySlot(slot)
- end
- end
- function turnToBlockToMine()
- faceWest()
- end
- function turnToStoneChest()
- faceSouth()
- end
- function turnToOreChest()
- faceNorth()
- end
- function blockReadyToMine()
- turnToBlockToMine()
- bool, block = turtle.inspect()
- return bool and block.name ~= "minecraft:stone"
- end
- function blockIsAir()
- turnToBlockToMine()
- bool = turtle.inspect()
- return not bool
- end
- function placeStone()
- turnToBlockToMine()
- turtle.select(STONE_SLOT)
- turtle.place()
- end
- while true do
- if blockReadyToMine() then
- turtle.dig()
- placeStone()
- end
- while blockIsAir() do
- turtle.attack()
- placeStone()
- end
- dropInvOres()
- fillStone()
- os.sleep(5)
- end
Add Comment
Please, Sign In to add comment