PrePistonEvent

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.neoforge.api.event.block.piston.PrePistonEvent;

Extends

PrePistonEvent extends PistonEvent.

Implements

PrePistonEvent implements the following interfaces:

ICancellableEvent

Listening to the event

This event can be listened to like so:

script.zs
events.register<crafttweaker.neoforge.api.event.block.piston.PrePistonEvent>(event => {
println("PrePistonEvent ran!");
});

Members

cancel()
Cancels the event. Same as setCanceled(true)
script.zs
// Pre.cancel();
event.cancel();
Getter
script.zs
// Pre.canceled as bool
event.canceled

Return Type: bool

Setter
script.zs
// Pre.canceled = (cancel as bool);
event.canceled = myBool;

Parameters:

cancel Type: bool
canceled() as bool
script.zs
// Pre.canceled() as bool;
event.canceled();

Return Type: bool

canceled(cancel as bool)
script.zs
// Pre.canceled(cancel as bool);
event.canceled(myBool);

Parameters:

cancel Type: bool
Getter
Gets the direction that the piston is facing.
script.zs
// Pre.direction as Direction
event.direction

Return Type: Direction

Getter
Gets the position that the piston is facing towards.
script.zs
// Pre.faceOffsetPos as BlockPos
event.faceOffsetPos

Return Type: BlockPos

Getter
script.zs
// Pre.level as Level
event.level

Return Type: Level

Getter
script.zs
// Pre.level as LevelAccessor
event.level

Return Type: LevelAccessor

Getter
Gets the move type of the piston (is it extending or retracting).
script.zs
// Pre.pistonMoveType as PistonMoveType
event.pistonMoveType

Return Type: PistonMoveType

Getter
script.zs
// Pre.pos as BlockPos
event.pos

Return Type: BlockPos

Getter
script.zs
// Pre.state as BlockState
event.state

Return Type: BlockState

Getter
Gets a **nullable** structure resolver that can be used to get all the blocks that will be affected by the piston.

Be sure to call the resolve() method on the structure resolver

script.zs
// Pre.structureHelper as PistonStructureResolver
event.structureHelper

Return Type: PistonStructureResolver