Combined redstone

Discussion in 'Spigot Plugin Development' started by Mihis, Jan 8, 2020.

  1. I want to make a plugin that will allow you to combine redstone (in block state).

    How can I trace to where the signal goes?
  2. This is complicated due to the redstone logic being really complicated (indirect powering, zero-tick stuff etc.), but generally you need to look at blocks nearby and search for redstone-interacting blocks. Then you take to those redstone-interacting blocks and make them the new center. You need to keep track of blocks you already identified ofc so you don't search them twice.
  3. Depends on how you exactly want to go about this. If you wish to trace the redstone signal from the source, then listen for when the redstone power is supplied by the first block, this might be done with BlockRedstoneEvent although it could be another event. Either way, once you get the source block, you need to listen for BlockRedstoneEvent anyways and everytime it's called, check for a surrounding block (1 block radius) for the last stored node, or block instance, starting from the source block. If you want to maintain a long trace of powered blocks, then use a LinkedList. You can check the list ofc to see if that block has already be checked, then I would unregister any further checks. You can also throw in a delayed runnable that will automatically unregister the checks, ofc I would cancel and reset this runnable everytime a new block is powered within the chain. Hopefully this made some sense.(y)

    Not sure what you're exactly asking for, but I would assume obtaining a trace of the redstone signal would be of use to your project.