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:
IAttachmentHolder,IBlockEntityExtension
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.level.block.entity.BlockEntity
BlockEntity.DataComponentInputNested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsField -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate 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 net.minecraft.world.level.block.entity.BlockEntity
level, remove, worldPositionFields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEY -
Constructor Summary
ConstructorsConstructorDescriptionPistonMovingBlockEntity(BlockPos pos, BlockState blockState) PistonMovingBlockEntity(BlockPos pos, BlockState blockState, BlockState movedState, Direction direction, boolean extending, boolean isSourcePiston) -
Method Summary
Modifier and TypeMethodDescriptionvoidprivate static voidfixEntityWithinPistonBase(BlockPos pos, Entity entity, Direction dir, double progress) private BlockStategetCollisionShape(BlockGetter level, BlockPos pos) private floatgetExtendedProgress(float progress) longprivate static doublegetMovement(AABB headShape, Direction direction, AABB facing) floatgetProgress(float partialTicks) getUpdateTag(HolderLookup.Provider registries) floatgetXOff(float partialTicks) floatgetYOff(float partialTicks) floatgetZOff(float partialTicks) booleanbooleanprivate booleanprotected voidloadAdditional(CompoundTag tag, HolderLookup.Provider registries) private static booleanmatchesStickyCritera(AABB box, Entity entity, BlockPos pos) private static AABBmoveByPositionAndProgress(BlockPos pos, AABB aabb, PistonMovingBlockEntity pistonMovingBlockEntity) private static voidmoveCollidedEntities(Level level, BlockPos pos, float partialTick, PistonMovingBlockEntity piston) private static voidmoveEntityByPiston(Direction noClipDirection, Entity entity, double progress, Direction direction) private static voidmoveStuckEntities(Level level, BlockPos pos, float partialTick, PistonMovingBlockEntity piston) protected voidsaveAdditional(CompoundTag tag, HolderLookup.Provider registries) voidstatic voidtick(Level level, BlockPos pos, BlockState state, PistonMovingBlockEntity blockEntity) Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity
addEntityType, applyComponents, applyComponentsFromItemStack, applyImplicitComponents, clearRemoved, collectComponents, collectImplicitComponents, components, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPersistentData, getPosFromTag, getType, getUpdatePacket, hasLevel, isRemoved, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, onlyOpCanSetNbt, parseCustomNameSafe, removeComponentsFromTag, removeData, saveCustomAndMetadata, saveCustomOnly, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setChanged, setComponents, setData, setRemoved, triggerEventMethods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, serializeAttachmentsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setDataMethods inherited from interface net.neoforged.neoforge.common.extensions.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:
-
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 pos, 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 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
-
moveCollidedEntities
private static void moveCollidedEntities(Level level, BlockPos pos, float partialTick, PistonMovingBlockEntity piston) -
moveEntityByPiston
-
moveStuckEntities
private static void moveStuckEntities(Level level, BlockPos pos, float partialTick, PistonMovingBlockEntity piston) -
matchesStickyCritera
-
isStickyForEntities
private boolean isStickyForEntities() -
getMovementDirection
-
getMovement
-
moveByPositionAndProgress
private static AABB moveByPositionAndProgress(BlockPos pos, AABB aabb, PistonMovingBlockEntity pistonMovingBlockEntity) -
fixEntityWithinPistonBase
-
getMovedState
-
finalTick
public void finalTick() -
tick
public static void tick(Level level, BlockPos pos, BlockState state, PistonMovingBlockEntity blockEntity) -
loadAdditional
- Overrides:
loadAdditionalin classBlockEntity
-
saveAdditional
- Overrides:
saveAdditionalin classBlockEntity
-
getCollisionShape
-
getLastTicked
public long getLastTicked() -
setLevel
- Overrides:
setLevelin classBlockEntity
-