Class PistonEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.level.BlockEvent
net.neoforged.neoforge.event.level.PistonEvent
- Direct Known Subclasses:
PistonEvent.Post
,PistonEvent.Pre
Base piston event, use
PistonEvent.Post
and PistonEvent.Pre
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
static class
Fires after the piston has moved and set surrounding states.static class
Fires before the piston has updated block states.Nested classes/interfaces inherited from class net.neoforged.neoforge.event.level.BlockEvent
BlockEvent.BlockToolModificationEvent, BlockEvent.BreakEvent, BlockEvent.EntityMultiPlaceEvent, BlockEvent.EntityPlaceEvent, BlockEvent.FarmlandTrampleEvent, BlockEvent.FluidPlaceBlockEvent, BlockEvent.NeighborNotifyEvent, BlockEvent.PortalSpawnEvent
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final net.minecraft.core.Direction
private final PistonEvent.PistonMoveType
-
Constructor Summary
ConstructorsConstructorDescriptionPistonEvent
(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction direction, PistonEvent.PistonMoveType moveType) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.core.Direction
net.minecraft.core.BlockPos
Helper method that gets the piston position offset by its facing@Nullable net.minecraft.world.level.block.piston.PistonStructureResolver
Methods inherited from class net.neoforged.neoforge.event.level.BlockEvent
getLevel, getPos, getState
-
Field Details
-
direction
private final net.minecraft.core.Direction direction -
moveType
-
-
Constructor Details
-
PistonEvent
public PistonEvent(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction direction, PistonEvent.PistonMoveType moveType) - Parameters:
pos
- - The position of the pistondirection
- - The move direction of the piston
-
-
Method Details
-
getDirection
public net.minecraft.core.Direction getDirection()- Returns:
- The direction of the piston block
-
getFaceOffsetPos
public net.minecraft.core.BlockPos getFaceOffsetPos()Helper method that gets the piston position offset by its facing -
getPistonMoveType
- Returns:
- The movement type of the piston (extension, retraction)
-
getStructureHelper
@Nullable public @Nullable net.minecraft.world.level.block.piston.PistonStructureResolver getStructureHelper()- Returns:
- A piston structure helper for this movement. Returns null if the world stored is not a
Level
-