Interface RedstoneDustPowerEvent

All Superinterfaces:
Cancellable, Event, RedstoneEvent

public interface RedstoneDustPowerEvent extends RedstoneEvent, Cancellable
Fired when redstone dust is about to change the power it carries, as a signal spreads along a line of dust or fades from it: one event per dust whose power changes.

The event is fired whatever implementation of redstone dust the world uses. With the vanilla one, dust takes its power from its own neighbours, one dust at a time, and may go through several levels before settling. With Alternate Current, the power of a whole network of dust is worked out at once, and each dust only fires the event for the level it settles on.

Changing the new power changes what the dust carries, and so what it passes on to the dust after it. Cancelling the event keeps the power the dust carries, as if oldPower() had been set as the new power.

Since:
0.1.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The highest power redstone dust carries.
    static final int
    The lowest power redstone dust carries.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the power the dust is about to carry, from 0 to 15.
    int
    Returns the power the dust carries, from 0 to 15.
    default int
    Returns the power the dust carries once the event is over: oldPower() if the event is cancelled, newPower() otherwise.
    void
    setNewPower(int newPower)
    Sets the power the dust carries once the event is over, in place of the one the signal gives it.

    Methods inherited from interface Cancellable

    isCancelled, setCancelled

    Methods inherited from interface RedstoneEvent

    block, position, world
  • Field Details

    • MIN_POWER

      static final int MIN_POWER
      The lowest power redstone dust carries.
      Since:
      0.1.0
      See Also:
    • MAX_POWER

      static final int MAX_POWER
      The highest power redstone dust carries.
      Since:
      0.1.0
      See Also:
  • Method Details

    • oldPower

      int oldPower()
      Returns the power the dust carries, from 0 to 15.
      Returns:
      the power the dust carries, from 0 to 15
      Since:
      0.1.0
    • newPower

      int newPower()
      Returns the power the dust is about to carry, from 0 to 15.
      Returns:
      the power the dust is about to carry, from 0 to 15
      Since:
      0.1.0
    • setNewPower

      void setNewPower(int newPower)
      Sets the power the dust carries once the event is over, in place of the one the signal gives it. The dust passes it on to the dust it powers, one less per block.
      Parameters:
      newPower - the power, from 0 to 15
      Throws:
      IllegalArgumentException - if the power is not between MIN_POWER and MAX_POWER
      Since:
      0.1.0
    • resultingPower

      default int resultingPower()
      Returns the power the dust carries once the event is over: oldPower() if the event is cancelled, newPower() otherwise.
      Returns:
      the power the dust carries once the event is over: oldPower() if the event is cancelled, newPower() otherwise
      Since:
      0.1.0