Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Variables --
- mouseWidth = 0
- mouseHeight = 0
- currentMob = "None"
- currentFarmStatus = "On "
- currentSpawnerStatus = "On "
- --Set turtle connection --
- rednet.open("bottom")
- Turtle = 17
- --Set monitor properties
- monitor = peripheral.wrap("left")
- monitor.clear()
- monitor.setCursorPos(1,1)
- w,h=monitor.getSize()
- --Write spawner status data --
- monitor.setBackgroundColor((colors.blue))
- monitor.setCursorPos(2,2)
- monitor.write("Farm control ")
- monitor.setBackgroundColor((colors.blue))
- monitor.setCursorPos(2,4)
- monitor.write("Status ")
- --Write farm status data --
- monitor.setBackgroundColor((colors.blue))
- monitor.setCursorPos(20,2)
- monitor.write("Spawner control ")
- monitor.setBackgroundColor((colors.blue))
- monitor.setCursorPos(20,4)
- monitor.write("Status ")
- function setCurrentSpawnerStatusData()
- if currentFarmStatus == "On " then
- monitor.setBackgroundColor((colors.green))
- elseif currentFarmStatus == "Off " then
- monitor.setBackgroundColor((colors.red))
- end
- monitor.setCursorPos(28,4)
- monitor.write(currentFarmStatus)
- end
- function setCurrentFarmStatusData()
- if currentSpawnerStatus == "On " then
- monitor.setBackgroundColor((colors.green))
- elseif currentSpawnerStatus == "Off " then
- monitor.setBackgroundColor((colors.red))
- end
- monitor.setCursorPos(10,4)
- monitor.write(currentSpawnerStatus)
- end
- function setCurrentMobData()
- --Write first list of mobs
- monitor.setBackgroundColor((colors.red))
- if currentMob == "Enderman" then
- monitor.setBackgroundColor((colors.green))
- end
- monitor.setCursorPos(2,6)
- monitor.write(" Enderman ")
- monitor.setBackgroundColor((colors.red))
- if currentMob == "Skeleton" then
- monitor.setBackgroundColor((colors.green))
- end
- monitor.setCursorPos(2,8)
- monitor.write(" Skeleton ")
- monitor.setBackgroundColor((colors.red))
- if currentMob == "Blaze" then
- monitor.setBackgroundColor((colors.green))
- end
- monitor.setCursorPos(2,10)
- monitor.write(" Blaze ")
- monitor.setBackgroundColor((colors.red))
- if currentMob == "Whisp" then
- monitor.setBackgroundColor((colors.green))
- end
- monitor.setCursorPos(2,12)
- monitor.write(" Whisp ")
- monitor.setBackgroundColor((colors.red))
- if currentMob == "Cow" then
- monitor.setBackgroundColor((colors.green))
- end
- monitor.setCursorPos(2,14)
- monitor.write(" Cow ")
- monitor.setBackgroundColor((colors.red))
- --Write second list of mobs
- if currentMob == "Ghast" then
- monitor.setBackgroundColor((colors.green))
- end
- monitor.setCursorPos(16,6)
- monitor.write(" Ghast ")
- monitor.setBackgroundColor((colors.red))
- if currentMob == "Chicken" then
- monitor.setBackgroundColor((colors.green))
- end
- monitor.setCursorPos(16,8)
- monitor.write(" Chicken ")
- monitor.setBackgroundColor((colors.red))
- monitor.setCursorPos(16,10)
- monitor.write(" None ")
- monitor.setBackgroundColor((colors.red))
- monitor.setCursorPos(16,12)
- monitor.write(" None ")
- monitor.setBackgroundColor((colors.red))
- if currentMob == "None" then
- monitor.setBackgroundColor((colors.green))
- end
- monitor.setCursorPos(16,14)
- monitor.write(" None ")
- end
- -- Perform clicked action --
- function checkClickPosition()
- --Farm Status --
- if(mouseWidth > 9 and mouseWidth < 14 and mouseHeight == 4) then
- --Clicked Status --
- if(currentFarmStatus == "On ") then
- currentFarmStatus = "Off "
- redstone.setOutput("right", false)
- elseif(currentFarmStatus == "Off ") then
- currentFarmStatus = "On "
- redstone.setOutput("right", true)
- end
- setCurrentFarmStatusData()
- end
- --Spawner Status --
- if(mouseWidth > 27 and mouseWidth < 32 and mouseHeight == 4) then
- --Clicked Status --
- if(currentSpawnerStatus == "On ") then
- currentSpawnerStatus = "Off "
- rednet.send(Turtle, "Off")
- elseif(currentSpawnerStatus == "Off ") then
- currentSpawnerStatus = "On "
- rednet.send(Turtle, "On")
- end
- setCurrentSpawnerStatusData()
- end
- -- 1st Row --
- if(mouseWidth > 1 and mouseWidth < 13 and mouseHeight == 6) then
- --Clicked Enderman --
- currentMob = "Enderman"
- setCurrentMobData()
- rednet.send(Turtle, 1)
- elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight == 6) then
- --Clicked Ghast--
- currentMob = "Ghast"
- setCurrentMobData()
- rednet.send(Turtle, 6)
- -- 2nd Row --
- elseif(mouseWidth > 1 and mouseWidth < 13 and mouseHeight == 8) then
- --Clicked Skeleton --
- currentMob = "Skeleton"
- setCurrentMobData()
- rednet.send(Turtle, 2)
- elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight == 8) then
- --Clicked Chicken --
- currentMob = "Chicken"
- setCurrentMobData()
- rednet.send(Turtle, 7)
- -- 3rd Row --
- elseif(mouseWidth > 1 and mouseWidth < 13 and mouseHeight == 10) then
- --Clicked Blaze
- currentMob = "Blaze"
- setCurrentMobData()
- rednet.send(Turtle, 3)
- elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight == 10) then
- --Clicked None --
- currentMob = "None"
- setCurrentMobData()
- rednet.send(Turtle, "Stop")
- -- 4th Row --
- elseif(mouseWidth > 1 and mouseWidth < 13 and mouseHeight == 12) then
- --Clicked Whisp --
- currentMob = "Whisp"
- setCurrentMobData()
- rednet.send(Turtle, 4)
- elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight == 12) then
- --Clicked None --
- currentMob = "None"
- setCurrentMobData()
- rednet.send(Turtle, "Stop")
- -- 5th Row --
- elseif(mouseWidth > 1 and mouseWidth < 13 and mouseHeight == 14) then
- --Clicked Cow --
- currentMob = "Cow"
- setCurrentMobData()
- rednet.send(Turtle, 5)
- elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight == 14) then
- --Clicked None --
- currentMob = "None"
- setCurrentMobData()
- rednet.send(Turtle, "Stop")
- end
- end
- --First time data setup --
- setCurrentMobData()
- setCurrentFarmStatusData()
- setCurrentSpawnerStatusData()
- repeat
- event,p1,p2,p3 = os.pullEvent()
- if event == "monitor_touch" then
- mouseWidth = p2
- mouseHeight = p3
- checkClickPosition()
- end
- until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement