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.DataComponentInput
Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsField
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private Direction
private boolean
Whether this piston is extending.private boolean
private long
private BlockState
private static final ThreadLocal
<Direction> private float
private float
The extension / retraction progressprivate static final double
static final double
private static final int
Fields inherited from class net.minecraft.world.level.block.entity.BlockEntity
level, remove, worldPosition
Fields 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 TypeMethodDescriptionvoid
private static void
fixEntityWithinPistonBase
(BlockPos pos, Entity entity, Direction dir, double progress) private BlockState
getCollisionShape
(BlockGetter level, BlockPos pos) private float
getExtendedProgress
(float progress) long
private static double
getMovement
(AABB headShape, Direction direction, AABB facing) float
getProgress
(float partialTicks) getUpdateTag
(HolderLookup.Provider registries) float
getXOff
(float partialTicks) float
getYOff
(float partialTicks) float
getZOff
(float partialTicks) boolean
boolean
private boolean
protected void
loadAdditional
(CompoundTag tag, HolderLookup.Provider registries) private static boolean
matchesStickyCritera
(AABB box, Entity entity, BlockPos pos) private static AABB
moveByPositionAndProgress
(BlockPos pos, AABB aabb, PistonMovingBlockEntity pistonMovingBlockEntity) private static void
moveCollidedEntities
(Level level, BlockPos pos, float partialTick, PistonMovingBlockEntity piston) private static void
moveEntityByPiston
(Direction noClipDirection, Entity entity, double progress, Direction direction) private static void
moveStuckEntities
(Level level, BlockPos pos, float partialTick, PistonMovingBlockEntity piston) protected void
saveAdditional
(CompoundTag tag, HolderLookup.Provider registries) void
static void
tick
(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, triggerEvent
Methods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, serializeAttachments
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData
Methods 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:
getUpdateTag
in 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:
loadAdditional
in classBlockEntity
-
saveAdditional
- Overrides:
saveAdditional
in classBlockEntity
-
getCollisionShape
-
getLastTicked
public long getLastTicked() -
setLevel
- Overrides:
setLevel
in classBlockEntity
-