Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local crystalSlot = 16
- local fullSlots = 0
- -- Functions
- local function wait()
- os.sleep(290)
- end
- local function getItems()
- for i = 1, 15 - fullSlots do
- turtle.select(i)
- turtle.suck()
- end
- end
- local function transferCrystals(amount)
- -- crystalSlot has Crystals or is empty
- local currentSlot = turtle.getSelectedSlot()
- if (turtle.getItemDetail(crystalSlot) == nil or turtle.getItemDetail(crystalSlot).name == "appliedenergistics2:item.ItemMultiMaterial") then
- print("Slot clear.")
- else
- print("Crystal Slot is used. Dropping items...")
- turtle.select(crystalSlot)
- drop()
- turtle.select(currentSlot)
- print("Items dropped.")
- end
- turtle.transferTo(crystalSlot, amount)
- end
- local function moveCrystalSlot()
- fullSlots = fullSlots + 1
- crystalSlot = crystalSlot - 1
- end
- local function compareSlots()
- local haveSeeds = false
- for i = 1, 15 - fullSlots do
- turtle.select(i)
- if (turtle.getItemDetail() and turtle.getItemDetail().name == "appliedenergistics2:item.ItemMultiMaterial") then
- print("Finished some Crystals.")
- if (turtle.getItemSpace(crystalSlot) == 0) then
- moveCrystalSlot()
- turtle.transferCrystals(turtle.getItemCount())
- elseif (turtle.getItemCount() > turtle.getItemSpace(crystalSlot)) then
- transferCrystals(turtle.getItemSpace())
- moveCrystalSlot()
- transferCrystals(turtle.getItemCount())
- else
- transferCrystals(turtle.getItemCount())
- end
- elseif (turtle.getItemDetail() and turtle.getItemDetail().name == "appliedenergistics2:item.ItemCrystalSeed") then
- turtle.drop()
- print("Still have seeds.")
- haveSeeds = true
- else
- turtle.drop()
- end
- end
- if (haveSeeds == true) then
- print("Restart process...")
- return false
- end
- return true
- end
- while(compareSlots() == false) do
- wait()
- getItems()
- end
Add Comment
Please, Sign In to add comment