PistonEvent

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.forge.api.event.block.piston.PistonEvent;

Extends

PistonEvent extends BlockEvent.

Members

cancel()
Cancels the event. Same as setCanceled(true)
script.zs
// PistonEvent.cancel();
myPistonEvent.cancel();
Getter
script.zs
// PistonEvent.cancelable as bool
myPistonEvent.cancelable

Return Type: bool

cancelable() as bool
script.zs
// PistonEvent.cancelable() as bool;
myPistonEvent.cancelable();

Return Type: bool

Getter
script.zs
// PistonEvent.canceled as bool
myPistonEvent.canceled

Return Type: bool

Setter
script.zs
// PistonEvent.canceled = (cancel as bool);
myPistonEvent.canceled = myBool;

Parameters:

cancel Type: bool
canceled() as bool
script.zs
// PistonEvent.canceled() as bool;
myPistonEvent.canceled();

Return Type: bool

canceled(cancel as bool)
script.zs
// PistonEvent.canceled(cancel as bool);
myPistonEvent.canceled(myBool);

Parameters:

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

Return Type: Direction

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

Return Type: BlockPos

Getter
script.zs
// PistonEvent.hasResult as bool
myPistonEvent.hasResult

Return Type: bool

hasResult() as bool
script.zs
// PistonEvent.hasResult() as bool;
myPistonEvent.hasResult();

Return Type: bool

Getter
script.zs
// PistonEvent.level as LevelAccessor
myPistonEvent.level

Return Type: LevelAccessor

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

Return Type: PistonMoveType

Getter
script.zs
// PistonEvent.pos as BlockPos
myPistonEvent.pos

Return Type: BlockPos

Getter
script.zs
// PistonEvent.result as Result
myPistonEvent.result

Return Type: EventResult

Setter
script.zs
// PistonEvent.result = (result as Result);
myPistonEvent.result = myResult;

Parameters:

result Type: EventResult
result() as Result
script.zs
// PistonEvent.result() as Result;
myPistonEvent.result();

Return Type: EventResult

result(result as Result)
script.zs
// PistonEvent.result(result as Result);
myPistonEvent.result(myResult);

Parameters:

result Type: EventResult
setAllow()
sets the event's result to allow
script.zs
// PistonEvent.setAllow();
myPistonEvent.setAllow();
setDefault()
sets the event's result to default
script.zs
// PistonEvent.setDefault();
myPistonEvent.setDefault();
setDeny()
sets the event's result to deny
script.zs
// PistonEvent.setDeny();
myPistonEvent.setDeny();
Getter
script.zs
// PistonEvent.state as BlockState
myPistonEvent.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
// PistonEvent.structureHelper as PistonStructureResolver
myPistonEvent.structureHelper

Return Type: PistonStructureResolver