1.17.x Tracing Redstone Signal

Discussion in 'Spigot Plugin Development' started by Qruet, Jun 15, 2021.

  1. As the title suggests, I want to be able to trace a redstone signal from point A to point B, or in other words - know where the signal originates from. My original approach was to listen for BlockRedstoneEvent and just record every powered block until I reach the block I'm curious of knowing where the source is coming from.

    My concern is how to deal with multiple redstone signals being run at the same time - especially if the signal I want to trace runs into a repeater and has a temporary delay. I need a way to make sure I don't accidentally begin tracing the wrong redstone signal that could run nearby while the delay is ongoing. For example, having to deal with a redstone repeater that is directly adjacent to another repeater. If the repeaters are carrying different redstone signals, I don't want my plugin to mistakenly think the adjacent repeater is being powered by the previous redstone signal I was tracing and begin tracing an entirely different signal.

    To make this project a bit simpler, I'm limiting the signal to being carried directly via just redstone dust and repeaters. My goal here is to add a new redstone block that is unique in that it reads an analogous signal (the redstone signal should carry a string of data from the "receiver" redstone block). So the binary nature of redstone inputs doesn't quite work here, and need a way to trace a signal with a unique data fingerprint to input into the custom powered block. I would like to avoid having to implement my own algorithm to determine where the signal will go next since that is already calculated by the server, and making those same calculations twice is inefficient and will put a strain on performance. I need to know where this result for the next block to be powered from the current block is being inevitably read from for the server to make its decision on which block to power.