Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monitor = peripheral.find("monitor")
- local chest = {peripheral.find("minecraft:chest")}
- local trash = {peripheral.find("appliedenergistics2:condenser")}
- term.redirect(monitor)
- term.setBackgroundColor(colors.black)
- term.clear()
- local enderPearlImage = paintutils.loadImage("graphics/enderPearl.nfp")
- paintutils.drawImage(enderPearlImage, 11, 2)
- function drawProgressBar(value, max)
- paintutils.drawLine(1, 11, 29, 11, colors.black)
- paintutils.drawLine(5, 10, 25, 10, colors.red)
- local pixel = math.ceil((20/max)*value)+5
- paintutils.drawLine(5, 10, pixel, 10, colors.green)
- local quantityString = value.." / "..max
- local xPos = math.ceil(29/2-#quantityString/2)
- term.setBackgroundColor(colors.black)
- term.setCursorPos(xPos, 11)
- term.write(quantityString)
- end
- function getChestFilledSlots(chest)
- local amount = 0
- for i, chest in pairs(chest.list()) do
- amount=amount+1
- end
- return amount
- end
- local storageSizes = {}
- local totalSlots = 0
- for i, chest in pairs(chest) do
- table.insert(storageSizes, chest.size())
- totalSlots=totalSlots+ chest.size()
- end
- local chestFilledSlots = {}
- while true do
- for i, chest in pairs(chest) do
- chestFilledSlots[i] = getChestFilledSlots(chest)
- end
- local totalFilledSlots = 0
- for i, amount in pairs(chestFilledSlots) do
- totalFilledSlots=totalFilledSlots+amount
- end
- for i=1,#chestFilledSlots do
- if chestFilledSlots[i]==storageSizes[i] then
- chest[i].pushItems(peripheral.getName(trash[1]), storageSizes[i])
- end
- end
- drawProgressBar(totalFilledSlots*64, totalSlots*64)
- sleep(0.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment