Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function findItem(itemName)
- for i=1,16 do
- local itemDetail = turtle.getItemDetail(i);
- if itemDetail and itemDetail.name == itemName then
- return i;
- end
- end
- return -1;
- end
- local function digSand()
- local hasBlock, blockData = turtle.inspect();
- if hasBlock and blockData.name == "minecraft:sand" then
- turtle.dig();
- end
- end
- local function main()
- while true do
- digSand();
- local sandSlot = findItem("minecraft:sand");
- if sandSlot ~= -1 then
- turtle.select(sandSlot);
- turtle.dropUp();
- end
- local soulsandSlot = findItem("minecraft:soul_sand");
- if soulsandSlot ~= -1 and not turtle.detect() then
- turtle.select(soulsandSlot);
- turtle.place();
- end
- end
- end
- main();
- -- DESIGN GOALS
- -- 1. Place soul sand when in inventory.
- -- 2. Mine sand if found in front of turtle.
- -- 3. Drop sand upwards if found in inventory.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement