Manually power block

Discussion in 'Plugin Development' started by Ne0nx3r0, Jan 8, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Ne0nx3r0

    Is there a way to set a block's power programmatically? For example, if I wanted to manually power a piece of redstone or a repeater (presuming I'm already willing to catch the redstone events and keep it powered), is that feasible?
     
  2. Offline

    fireblast709

    Not sure. You might want to keep using event.setNewPower(some power) in the BlockRedstoneEvent
     
  3. Offline

    Ne0nx3r0

    I get that, but I'm not sure how to initially power the block, other than by using an external power source, or in the case of lamps/torches setting it to on.
     
  4. Offline

    fireblast709

    There is no way to do that with Bukkit. Not sure if there is a possibility in NMS though (although I understand if you do not want to use that :p)
     
  5. Offline

    Ne0nx3r0

    Well, I wouldn't mind it, I'm just not at all familiar with how to dig into NMS code and find things. Unfortunately I'm still a skiddie in that arena.
     
  6. Offline

    fireblast709

    Mhh forgot that the block id changes on some blocks (like torches and diodes). You could use that and cancel the unpowering
     
  7. Offline

    Ne0nx3r0

    I suppose that could work; set the block to a redstone lamp (on) and put it a pending queue, then catch the redstone de-power event and set it to the original block (with data) then cancel the event.

    Hacky... But it could work, and you'd only need to do it initially to setup the connection.

    Still, I'd prefer to just manually power the block then catch events from there, that seems like a less buggy solution.
     
  8. Offline

    fireblast709

    for setting a redstone lamp on, I think setting the id is the only option (sadly enough)
     
Thread Status:
Not open for further replies.

Share This Page