Class PistonMovingBlockEntity

All Implemented Interfaces:
IAttachmentHolder, IBlockEntityExtension

public class PistonMovingBlockEntity extends BlockEntity
  • Field Details

    • TICKS_TO_EXTEND

      private static final int TICKS_TO_EXTEND
      See Also:
    • PUSH_OFFSET

      private static final double PUSH_OFFSET
      See Also:
    • TICK_MOVEMENT

      public static final double TICK_MOVEMENT
      See Also:
    • movedState

      private BlockState movedState
    • direction

      private Direction direction
    • extending

      private boolean extending
      Whether this piston is extending.
    • isSourcePiston

      private boolean isSourcePiston
    • NOCLIP

      private static final ThreadLocal<Direction> NOCLIP
    • progress

      private float progress
    • progressO

      private float progressO
      The extension / retraction progress
    • lastTicked

      private long lastTicked
    • deathTicks

      private int deathTicks
  • Constructor Details

    • PistonMovingBlockEntity

      public PistonMovingBlockEntity(BlockPos pos, BlockState blockState)
    • PistonMovingBlockEntity

      public PistonMovingBlockEntity(BlockPos pos, BlockState blockState, BlockState movedState, Direction direction, boolean extending, boolean isSourcePiston)
  • Method Details

    • getUpdateTag

      public CompoundTag getUpdateTag(HolderLookup.Provider registries)
      Overrides:
      getUpdateTag in class BlockEntity
    • isExtending

      public boolean isExtending()
    • getDirection

      public Direction getDirection()
    • isSourcePiston

      public boolean isSourcePiston()
    • getProgress

      public float getProgress(float partialTicks)
      Returns:
      interpolated progress value (between lastProgress and progress) given the partialTicks
    • getXOff

      public float getXOff(float partialTicks)
    • getYOff

      public float getYOff(float partialTicks)
    • getZOff

      public float getZOff(float partialTicks)
    • getExtendedProgress

      private float getExtendedProgress(float progress)
    • getCollisionRelatedBlockState

      private BlockState getCollisionRelatedBlockState()
    • moveCollidedEntities

      private static void moveCollidedEntities(Level level, BlockPos pos, float partialTick, PistonMovingBlockEntity piston)
    • moveEntityByPiston

      private static void moveEntityByPiston(Direction noClipDirection, Entity entity, double progress, Direction direction)
    • moveStuckEntities

      private static void moveStuckEntities(Level level, BlockPos pos, float partialTick, PistonMovingBlockEntity piston)
    • matchesStickyCritera

      private static boolean matchesStickyCritera(AABB box, Entity entity, BlockPos pos)
    • isStickyForEntities

      private boolean isStickyForEntities()
    • getMovementDirection

      public Direction getMovementDirection()
    • getMovement

      private static double getMovement(AABB headShape, Direction direction, AABB facing)
    • moveByPositionAndProgress

      private static AABB moveByPositionAndProgress(BlockPos pos, AABB aabb, PistonMovingBlockEntity pistonMovingBlockEntity)
    • fixEntityWithinPistonBase

      private static void fixEntityWithinPistonBase(BlockPos pos, Entity entity, Direction dir, double progress)
    • getMovedState

      public BlockState getMovedState()
    • finalTick

      public void finalTick()
    • tick

      public static void tick(Level level, BlockPos pos, BlockState state, PistonMovingBlockEntity blockEntity)
    • loadAdditional

      protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries)
      Overrides:
      loadAdditional in class BlockEntity
    • saveAdditional

      protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries)
      Overrides:
      saveAdditional in class BlockEntity
    • getCollisionShape

      public VoxelShape getCollisionShape(BlockGetter level, BlockPos pos)
    • getLastTicked

      public long getLastTicked()
    • setLevel

      public void setLevel(Level level)
      Overrides:
      setLevel in class BlockEntity