Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- chest = peripheral.wrap("diamond_0")
- extractor = peripheral.wrap("right")
- grinder = peripheral.wrap("Grinder_0")
- grinderGearbox = peripheral.wrap("AdvancedGears_0")
- furnaceOne = peripheral.wrap("container_furnace_1")
- furnaceTwo = peripheral.wrap("container_furnace_2")
- furnaceOneGearbox = peripheral.wrap("AdvancedGears_2")
- furnaceTwoGearbox = peripheral.wrap("AdvancedGears_3")
- redstoneCyan = false
- redstoneBlue = false
- redstoneRed = true
- chargingFurnaceOneGearbox = false
- chargingFurnaceTwoGearbox = false
- chargingGrinderGearbox = false
- x = 0
- while true do
- x = x + 1
- if x > 9 then
- chest.condenseItems()
- x = 0
- end
- anItem = chest.getStackInSlot(chest.getInventorySize())
- if anItem then
- redstoneRed = false
- print("Found an item in last slot, starting engines")
- processing = true
- end
- slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9 = extractor.printInv()
- if slot1 == "Empty" and slot2 == "Empty" and slot3 == "Empty" and slot4 == "Empty" and slot5 == "Empty" and slot6 == "Empty" and slot7 == "Empty" and slot8 == "Empty" then
- processing = false
- end
- if ( slot2 ~= "Empty" or slot3 ~= "Empty" ) and slot7 == "Empty" then
- redstoneBrown = true
- redstoneLime = false
- print("Speeding up stage 2 and 3")
- else
- redstoneBrown = false
- if ( slot5 ~= "Empty" ) then
- redstoneLime = true
- print("Speeding up stage 4")
- else
- redstoneLime = false
- end
- end
- if furnaceOne.getStackInSlot(1) and chargingFurnaceOneGearbox == false then
- redstonePink = true
- print("Stuff to cook, furnace1")
- else
- redstonePink = false
- end
- if furnaceTwo.getStackInSlot(1) and chargingFurnaceTwoGearbox == false then
- redstoneLightgray = true
- print("Stuff to cook, furnace2")
- else
- redstoneLightgray = false
- end
- a = grinder.printInv()
- if a ~= "Empty" and chargingGrinderGearbox == false then
- redstonePurple = true
- print("Stuff to grind")
- else
- redstonePurple = false
- end
- a,b = furnaceOneGearbox.getEnergy()
- c,d = furnaceTwoGearbox.getEnergy()
- if a < 100000000000 or c < 100000000000 then
- if a < 100000000000 then
- redstonePink = false
- redstoneGray = false
- chargingFurnaceOneGearbox = true
- else
- redstoneLightgray = false
- redstoneGray = true
- chargingFurnaceTwoGearbox = true
- end
- redstoneRed = false
- redstoneCyan = true
- print("A furnace gearbox is low, starting engines to charge")
- else
- e,f = grinderGearbox.getEnergy()
- if e < 100000000000 then
- redstonePurple = false
- redstoneRed = false
- redstoneBlue = true
- chargingGrinderGearbox = true
- print("Grinder gearbox under half, starting engines to charge")
- end
- end
- if ( ( ( chargingFurnaceOneGearbox == true and a > 300000000000 ) or ( chargingFurnaceTwoGearbox == true and c > 300000000000 ) or ( chargingGrinderGearbox == true and e > 300000000000 ) and processing == false ) or (processing == false and chargingFurnaceOneGearbox == false and chargingFurnaceTwoGearbox == false and chargingGrinderGearbox == false ) ) and redstoneRed == false then
- if a > 300000000000 then
- chargingFurnaceOneGearbox = false
- elseif c > 300000000000 then
- chargingFurnaceTwoGearbox = false
- elseif e > 300000000000 then
- chargingGrinderGearbox = false
- end
- redstoneCyan = false
- redstoneBlue = false
- print("Engines not needed, turning off")
- redstoneRed = true
- end
- redstoneOutput = 0
- if redstoneLime then
- redstoneOutput = redstoneOutput + colors.lime
- end
- if redstoneRed then
- redstoneOutput = redstoneOutput + colors.red
- end
- if redstonePink then
- redstoneOutput = redstoneOutput + colors.pink
- print("Trying to run furnace 1")
- end
- if redstoneGray then
- redstoneOutput = redstoneOutput + colors.gray
- end
- if redstoneCyan then
- redstoneOutput = redstoneOutput + colors.cyan
- print("Trying to charge furnace coil(s)")
- end
- if redstoneLightgray then
- redstoneOutput = redstoneOutput + colors.lightGray
- print("Trying to run furnace 2")
- end
- if redstoneBlue then
- redstoneOutput = redstoneOutput + colors.blue
- print("Trying to charge grinder coil")
- end
- if redstonePurple then
- redstoneOutput = redstoneOutput + colors.purple
- end
- if redstoneBrown then
- redstoneOutput = redstoneOutput + colors.brown
- end
- redstone.setBundledOutput("bottom", redstoneOutput)
- os.sleep(2)
- print("Looping")
- end
Advertisement