Redstone repeaters event handling

Discussion in 'Bukkit Help' started by ntvf, Oct 19, 2011.

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

    ntvf

    Hi everyone.

    I can't realize one simple thing: I want to change Diode ( redstore repeater ) state ( turn on/off ) inside the scheduled task.

    I'he got diode block from event captured inside the
    Code:
    public void onBlockPhysics(BlockPhysicsEvent event)
    In that way
    Code:
    Block triggered_block = event.getBlock();
    diode = (Diode) triggered_block.getState().getData();
    Then after I schedule task:
    Code:
    plugin.getServer().getScheduler().scheduleAsyncDelayedTask( plugin, new Runnable() {
    How can I activate or deactivate my diode inside the task?
    And is it possible to activate/deactivate repeater at all?

    Thanks.
     
  2. Offline

    ntvf

    I have found solution
    Code:
    byte data = diode_block.getData();
    diode_block.setTypeIdAndData( 94, data, false );
    But I have another issue with the physics event scheme for diode.
    As I understand, diode work cycle triggers 20 events ( ten for DIODE_BLOCK_OFF and ten DIODE_BLOCK_ON )

    So, I want to put some delay between steps 2 and 3.
    Is it possible?


    Diode working cycle events scheme:
    Code:
    01. DIODE_BLOCK_OFF -- Signal accepted ( first event for diode )
    02. DIODE_BLOCK_OFF
    03. DIODE_BLOCK_ON -- Actually turned on and transmit signal
    04. DIODE_BLOCK_ON
    05. DIODE_BLOCK_ON
    06. DIODE_BLOCK_ON
    07. DIODE_BLOCK_ON
    08. DIODE_BLOCK_ON
    09. DIODE_BLOCK_ON
    10. DIODE_BLOCK_ON
    
    11. DIODE_BLOCK_ON -- Preserve On-state ( until signal faded + diode delay )
    
    12. DIODE_BLOCK_ON -- Signal faded — turned off
    13. DIODE_BLOCK_OFF -- actually turned off
    14. DIODE_BLOCK_OFF
    15. DIODE_BLOCK_OFF
    16. DIODE_BLOCK_OFF
    17. DIODE_BLOCK_OFF
    18. DIODE_BLOCK_OFF
    19. DIODE_BLOCK_OFF
    20. DIODE_BLOCK_OFF -- last event for diode
     
  3. Offline

    Zaros

    Wrong section, you need to post this in Development.
     
  4. Offline

    ntvf

    Damn! Delete this thread, please.
     
Thread Status:
Not open for further replies.

Share This Page