Interface RedstoneDustPowerEvent
- All Superinterfaces:
Cancellable, Event, RedstoneEvent
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 -
Method Summary
Modifier and TypeMethodDescriptionintnewPower()Returns the power the dust is about to carry, from0to15.intoldPower()Returns the power the dust carries, from0to15.default intReturns the power the dust carries once the event is over:oldPower()if the event is cancelled,newPower()otherwise.voidsetNewPower(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, setCancelledMethods inherited from interface RedstoneEvent
block, position, world
-
Field Details
-
MIN_POWER
static final int MIN_POWERThe lowest power redstone dust carries.- Since:
- 0.1.0
- See Also:
-
MAX_POWER
static final int MAX_POWERThe highest power redstone dust carries.- Since:
- 0.1.0
- See Also:
-
-
Method Details
-
oldPower
int oldPower()Returns the power the dust carries, from0to15.- Returns:
- the power the dust carries, from
0to15 - Since:
- 0.1.0
-
newPower
int newPower()Returns the power the dust is about to carry, from0to15.- Returns:
- the power the dust is about to carry, from
0to15 - 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, from0to15- Throws:
IllegalArgumentException- if the power is not betweenMIN_POWERandMAX_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
-