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

public abstract class PistonEvent extends BlockEvent
Base piston event, use PistonEvent.Post and PistonEvent.Pre
  • Field Details

  • 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 piston
      direction - - 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

      public PistonEvent.PistonMoveType 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