Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modem = peripheral.find("modem")
- modem.open(3777)
- local function CastBlocks(numOfBlocks)
- while numOfBlocks > 0 do
- print("smelting",numOfBlocks,"blocks")
- if numOfBlocks >=3 then
- numOfBlocks = numOfBlocks - 3
- redstone.setOutput("back",true)
- sleep(1)
- redstone.setOutput("back",false)
- elseif numOfBlocks >=2 then
- numOfBlocks = numOfBlocks - 2
- redstone.setOutput("front",true)
- sleep(0.15)
- redstone.setOutput("left",true)
- sleep(1)
- redstone.setOutput("front",false)
- redstone.setOutput("left",false)
- else
- numOfBlocks = numOfBlocks - 1
- redstone.setOutput("front",true)
- sleep(1)
- redstone.setOutput("front",false)
- end
- sleep(1)
- os.pullEvent("redstone")
- print("A redstone input has changed!")
- sleep(2)
- end
- end
- local function CastIngots(numOfIngots)
- while numOfIngots > 0 do
- print("smelting",numOfIngots,"Ingots")
- redstone.setOutput("right",true)
- sleep(1)
- redstone.setOutput("right",false)
- sleep(0.3)
- numOfIngots = numOfIngots - 1
- os.pullEvent("redstone")
- print("A redstone input has changed!")
- sleep(2)
- end
- end
- while true do
- local event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
- if message[2] == "Blocks" then
- CastBlocks(message[1])
- modem.transmit(3777,3777,"done")
- elseif message[2] == "Ingots" then
- CastIngots(message[1])
- modem.transmit(3777,3777,"done")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement