Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --index--
- local target_block = "back"
- local testing_method = 4 -- getBlockStates
- local text_scale = 0.5
- --index end--
- local age_list = {}
- for i = 0, 24 do
- age_list[i] = 0
- end
- local monitor = peripheral.find("monitor")
- monitor.clear()
- monitor.setTextScale(text_scale)
- local function printAgeList()
- monitor.clear()
- monitor.setCursorPos(1, 1)
- monitor.setTextColor(colors.white)
- monitor.write("Vine Age Counter")
- local y = 2
- for i = 0, 24 do
- monitor.setCursorPos(1, y)
- monitor.write(string.format("%2d : %d", i, age_list[i]))
- y = y + 1
- end
- end
- local method_table = peripheral.getMethods(target_block)
- if method_table ~= nil then
- while true do
- if redstone.getInput("front") then
- local test_result = peripheral.call(target_block, method_table[testing_method])
- if type(test_result) == "table" and test_result["age"] then
- local age = test_result["age"]
- if age >= 0 and age <= 24 then
- age_list[age] = age_list[age] + 1
- end
- end
- printAgeList()
- repeat sleep(0.1) until not redstone.getInput("front")
- end
- sleep(0.1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment