Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Monitors stuff
- local monitors
- monitors = peripheral.wrap("left")
- function resetColors()
- monitors.setTextColor(colors.white)
- monitors.setBackgroundColor(colors.black)
- end
- --Loading screen
- monitors.clear()
- monitors.setCursorPos(1,1)
- monitors.write("Loading....")
- local AE2
- AE2 = peripheral.wrap("tileinterface_4")
- local items
- local numberOfItems
- local coalSpeed = 0
- local coalSpeedValuesTable = {0,0,0,0,0,0,0,0,0,0}
- local averageTenMinuteMiningSpeed
- function regetItems()
- items = AE2.getAvailableItems(1)
- numberOfItems = #items
- end
- function newLine()
- local x
- local y
- x, y = monitors.getCursorPos()
- y = y + 1
- monitors.setCursorPos(1,y)
- end
- function getAverageCoal()
- local sum = 0
- for i = 1, #coalSpeedValuesTable, 1 do
- sum = sum + coalSpeedValuesTable[i]
- end
- averageTenMinuteMiningSpeed = sum / #coalSpeedValuesTable
- end
- function addToList(table, number)
- for i = 1, #table - 1, 1 do
- j = i + 1
- table[i] = table[j]
- end
- table[#table] = number
- return table
- end
- function writeToScreen(text)
- --Resetting screen
- monitors.clear()
- monitors.setCursorPos(1,1)
- --Header
- monitors.setBackgroundColor(colors.red)
- monitors.write("********************************")
- newLine()
- monitors.write(" AE2 Monitoring program ")
- newLine()
- monitors.write("********************************")
- newLine()
- monitors.setBackgroundColor(colors.black)
- monitors.setTextColor(colors.magenta)
- monitors.write("Written by Merlione404")
- resetColors()
- --Real information
- newLine()
- newLine()
- monitors.write("Mining coal at: "..coalSpeed.." per minute")
- newLine()
- monitors.write("Average of the last 10 minutes: "..averageTenMinuteMiningSpeed.." per minute")
- newLine()
- monitors.write(text)
- end
- function getNBTHash(itemname)
- regetItems()
- for i = 1, numberOfItems, 1 do
- if items[i].fingerprint.id == itemname then
- return items[i].fingerprint.nbt_hash
- end
- end
- end
- regetItems()
- coalhash = getNBTHash("minecraft:coal")
- coal = {id = "minecraft:coal", dmg = 0, nbt_hash= coalhash}
- local oldCoalNumber
- local newCoalNumber
- while true do
- oldCoalNumber = AE2.getItemDetail(coal , false).qty
- sleep(60)
- coalSpeed = AE2.getItemDetail(coal , false).qty - oldCoalNumber
- coalSpeedValuesTable = addToList(coalSpeedValuesTable, coalSpeed)
- getAverageCoal()
- writeToScreen(".....")
- end
Advertisement
Add Comment
Please, Sign In to add comment