Interface PistonEvent
- All Superinterfaces:
Cancellable, Event, RedstoneEvent
- All Known Subinterfaces:
PistonExtendEvent, PistonRetractEvent
An event about a piston about to move:
RedstoneEvent.position() is its base, and RedstoneEvent.block() the
state of that base before it moves.
It is fired once the piston worked out what it moves, and before anything changed in the world. Cancelling it leaves the piston and the blocks around it as they are; the piston tries again the next time one of its neighbours changes.
- Since:
- 0.1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturns where the blocks the piston is about to break are: those in its way that do not withstand being pushed, such as a torch or a flower.Returns the side the piston faces, the one its head comes out of.Returns where the blocks the piston is about to move are, before they move; each ends up one block further alongmovement().movement()Returns the side the blocks move towards.booleansticky()Returnstruefor a sticky piston.Methods inherited from interface Cancellable
isCancelled, setCancelledMethods inherited from interface RedstoneEvent
block, position, world
-
Method Details
-
direction
BlockFace direction()Returns the side the piston faces, the one its head comes out of.- Returns:
- the side the piston faces, the one its head comes out of
- Since:
- 0.1.0
-
sticky
boolean sticky()Returnstruefor a sticky piston.- Returns:
truefor a sticky piston- Since:
- 0.1.0
-
movement
BlockFace movement()Returns the side the blocks move towards.:direction()when the piston extends, its opposite when it retracts- Returns:
- the side the blocks move towards
- Since:
- 0.1.0
-
movedBlocks
List<BlockPosition> movedBlocks()Returns where the blocks the piston is about to move are, before they move; each ends up one block further alongmovement().The head of the piston is not one of them. The list cannot be modified, and is empty when the piston moves nothing but its head.
- Returns:
- where the blocks the piston is about to move are, before they move; each ends up one
block further along
movement() - Since:
- 0.1.0
-
brokenBlocks
List<BlockPosition> brokenBlocks()Returns where the blocks the piston is about to break are: those in its way that do not withstand being pushed, such as a torch or a flower.The list cannot be modified.
- Returns:
- where the blocks the piston is about to break are: those in its way that do not withstand being pushed, such as a torch or a flower
- Since:
- 0.1.0
-