BlockStates are immutable, so it’s not possible to
Keys to them in the same way as you might an
with(Key, value) method returns a new
BlockState with the given data (provided that it supports that
Key, otherwise it’ll return
Optional.empty()). This new
BlockState can then replace the other one through
However, I’m not sure if that would have the desired functionality for you because it likely just changes the state without running the code that performs the relative actions - you may end up powering one block for a tick, but it may not effect any other blocks. I’ve never worked with redstone through the API, but my understanding is that it’s a bit limited and due for some updates. Hopefully, someone familiar with this area of the API can take a look at this and point you in the right direction.
As a minor note, the
BlockType is available from the
BlockState and prevents the same lookup from being done twice.