Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Clears the generated .blacklist file before start equivilant to "delete .blacklist" and loads default values
- -- OreQuarry REDUX by default uses a dynamic .blacklist file that is updated every time the program starts but saves previous values
- clearBlacklist = false
- -- Default blacklist values ***This is ignored after a .blacklist file has been generated unless "clearBlacklist = true"***
- local blacklistArray = {
- ["minecraft:air"] = true,
- ["minecraft:bedrock"] = true,
- ["minecraft:cobblestone"] = true,
- ["minecraft:dirt"] = true,
- ["minecraft:ice"] = true,
- ["minecraft:ladder"] = true,
- ["minecraft:snow"] = true,
- ["minecraft:snow_layer"] = true,
- ["minecraft:stone"] = true,
- ["minecraft:grass"] = true,
- ["minecraft:torch"] = true
- }
- --Checks to see if a blacklist file has been generated, imports current blacklist, adds items in slots 1-14 to blacklist
- function checkBlacklist()
- if clearBlacklist == false then
- if fs.exists(".blacklist") then
- --Opens the .blacklist file and loads contents to blacklistArray
- local file = fs.open(".blacklist","r")
- local data = file.readAll()
- file.close()
- blacklistArray = textutils.unserialize(data)
- end
- --Compares items in slots 1-14 with blacklistArray adds item to blacklistArray if not already specified
- for i=1,14 do
- turtle.select(i)
- local item = turtle.getItemDetail()
- if item then
- if blacklistArray[item.name] then
- else
- print("Added "..item.name.." to the blacklist!")
- blacklistArray[item.name] = true
- end
- end
- end
- --Writes the updated blacklistArray to .blacklist for next run
- local file = fs.open(".blacklist","w")
- file.write(textutils.serialize(blacklistArray))
- file.close()
- else
- --if clearBlacklist = true deletes previous .blacklist and generates fresh list from table and turtle inventory
- fs.delete(".blacklist")
- clearBlacklist = false
- checkBlacklist()
- end
- end
Add Comment
Please, Sign In to add comment