Class PistonMovingBlockEntity
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
net.minecraft.world.level.block.piston.PistonMovingBlockEntity
- All Implemented Interfaces:
TypedInstance<BlockEntityType<?>>, DebugValueSource, IAttachmentHolder, IBlockEntityExtension
-
Nested Class Summary
Nested classes/interfaces inherited from class AttachmentHolder
AttachmentHolder.AsFieldNested classes/interfaces inherited from interface DebugValueSource
DebugValueSource.Registration, DebugValueSource.ValueGetter<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate static final BlockStateprivate static final booleanprivate static final floatprivate static final booleanprivate Directionprivate booleanWhether this piston is extending.private booleanprivate longprivate BlockStateprivate static final ThreadLocal<Direction> private floatprivate floatThe extension / retraction progressprivate static final doublestatic final doubleprivate static final intFields inherited from class BlockEntity
level, remove, worldPositionFields inherited from class AttachmentHolder
ATTACHMENTS_NBT_KEY -
Constructor Summary
ConstructorsConstructorDescriptionPistonMovingBlockEntity(BlockPos worldPosition, BlockState blockState) PistonMovingBlockEntity(BlockPos worldPosition, BlockState blockState, BlockState movedState, Direction direction, boolean extending, boolean isSourcePiston) -
Method Summary
Modifier and TypeMethodDescriptionvoidprivate static voidfixEntityWithinPistonBase(BlockPos pos, Entity entity, Direction direction, double deltaProgress) private BlockStategetCollisionShape(BlockGetter level, BlockPos pos) private floatgetExtendedProgress(float progress) longprivate static doublegetMovement(AABB aabbToBeOutsideOf, Direction movement, AABB aabb) floatgetProgress(float a) getUpdateTag(HolderLookup.Provider registries) floatgetXOff(float a) floatgetYOff(float a) floatgetZOff(float a) booleanbooleanprivate booleanprotected voidloadAdditional(ValueInput input) private static booleanmatchesStickyCritera(AABB aabb, Entity entity, BlockPos pos) private static AABBmoveByPositionAndProgress(BlockPos pos, AABB aabb, PistonMovingBlockEntity entity) private static voidmoveCollidedEntities(Level level, BlockPos pos, float newProgress, PistonMovingBlockEntity self) private static voidmoveEntityByPiston(Direction pistonDirection, Entity entity, double delta, Direction movement) private static voidmoveStuckEntities(Level level, BlockPos pos, float newProgress, PistonMovingBlockEntity self) voidpreRemoveSideEffects(BlockPos pos, BlockState state) protected voidsaveAdditional(ValueOutput output) voidstatic voidtick(Level level, BlockPos pos, BlockState state, PistonMovingBlockEntity entity) Methods inherited from class BlockEntity
addEntityType, applyComponents, applyComponentsFromItemStack, applyImplicitComponents, clearRemoved, collectComponents, collectImplicitComponents, components, fillCrashReportCategory, getAndClearAttachmentTypesToSync, getBlockPos, getBlockState, getLevel, getNameForReporting, getPersistentData, getPosFromTag, getType, getUpdatePacket, hasLevel, isRemoved, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, parseCustomNameSafe, problemPath, registerDebugValues, removeComponentsFromTag, removeData, saveCustomOnly, saveCustomOnly, saveWithFullMetadata, saveWithFullMetadata, saveWithId, saveWithoutMetadata, saveWithoutMetadata, setBlockState, setChanged, setChanged, setComponents, setData, setRemoved, syncData, triggerEvent, typeHolderMethods inherited from class AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, serializeAttachmentsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncDataMethods inherited from interface IBlockEntityExtension
getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdate
-
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:
-
DEFAULT_BLOCK_STATE
-
DEFAULT_PROGRESS
private static final float DEFAULT_PROGRESS- See Also:
-
DEFAULT_EXTENDING
private static final boolean DEFAULT_EXTENDING- See Also:
-
DEFAULT_SOURCE
private static final boolean DEFAULT_SOURCE- See Also:
-
movedState
-
direction
-
extending
private boolean extendingWhether this piston is extending. -
isSourcePiston
private boolean isSourcePiston -
NOCLIP
-
progress
private float progress -
progressO
private float progressOThe extension / retraction progress -
lastTicked
private long lastTicked -
deathTicks
private int deathTicks
-
-
Constructor Details
-
PistonMovingBlockEntity
-
PistonMovingBlockEntity
public PistonMovingBlockEntity(BlockPos worldPosition, BlockState blockState, BlockState movedState, Direction direction, boolean extending, boolean isSourcePiston)
-
-
Method Details
-
getUpdateTag
- Overrides:
getUpdateTagin classBlockEntity
-
isExtending
public boolean isExtending() -
getDirection
-
isSourcePiston
public boolean isSourcePiston() -
getProgress
public float getProgress(float a) - Returns:
- interpolated progress value (between lastProgress and progress) given the partialTicks
-
getXOff
public float getXOff(float a) -
getYOff
public float getYOff(float a) -
getZOff
public float getZOff(float a) -
getExtendedProgress
private float getExtendedProgress(float progress) -
getCollisionRelatedBlockState
-
moveCollidedEntities
private static void moveCollidedEntities(Level level, BlockPos pos, float newProgress, PistonMovingBlockEntity self) -
moveEntityByPiston
-
moveStuckEntities
private static void moveStuckEntities(Level level, BlockPos pos, float newProgress, PistonMovingBlockEntity self) -
matchesStickyCritera
-
isStickyForEntities
private boolean isStickyForEntities() -
getMovementDirection
-
getMovement
-
moveByPositionAndProgress
private static AABB moveByPositionAndProgress(BlockPos pos, AABB aabb, PistonMovingBlockEntity entity) -
fixEntityWithinPistonBase
-
getMovedState
-
finalTick
public void finalTick() -
preRemoveSideEffects
- Overrides:
preRemoveSideEffectsin classBlockEntity
-
getPushDirection
-
tick
public static void tick(Level level, BlockPos pos, BlockState state, PistonMovingBlockEntity entity) -
loadAdditional
- Overrides:
loadAdditionalin classBlockEntity
-
saveAdditional
- Overrides:
saveAdditionalin classBlockEntity
-
getCollisionShape
-
getLastTicked
public long getLastTicked() -
setLevel
- Overrides:
setLevelin classBlockEntity
-