Class PistonBlockEntity
java.lang.Object
org.geysermc.geyser.translator.level.block.entity.PistonBlockEntity
-
Constructor Summary
ConstructorDescriptionPistonBlockEntity(GeyserSession session, com.nukkitx.math.vector.Vector3i position, Direction orientation, boolean sticky, boolean extended)
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.nukkitx.nbt.NbtMap
buildStaticPistonTag(com.nukkitx.math.vector.Vector3i position, boolean extended, boolean sticky)
Create a piston data tag that has fully extended/retractedboolean
boolean
checkCollision(com.nukkitx.math.vector.Vector3i blockPos, BoundingBox boundingBox)
double
computeCollisionOffset(com.nukkitx.math.vector.Vector3i blockPos, BoundingBox boundingBox, Axis axis, double movement)
Compute the maximum movement of a bounding box that won't collide with the moving block attached to this pistoncom.github.steveice10.mc.protocol.data.game.level.block.value.PistonValueType
com.nukkitx.math.vector.Vector3i
boolean
isDone()
void
Push the player If the player is pushed, the displacement is added to playerDisplacement in PistonCache If the player contacts a slime block, playerMotion in PistonCache is updatedvoid
setAction(com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValueType action)
Set whether the piston is pulling or pushing blocksvoid
setAction(com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValueType action, it.unimi.dsi.fastutil.objects.Object2IntMap<com.nukkitx.math.vector.Vector3i> attachedBlocks)
void
Place attached blocks in their final position when done pushing or pullingvoid
Update the position of the piston head, moving blocks, and players.
-
Constructor Details
-
PistonBlockEntity
public PistonBlockEntity(GeyserSession session, com.nukkitx.math.vector.Vector3i position, Direction orientation, boolean sticky, boolean extended)
-
-
Method Details
-
setAction
public void setAction(com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValueType action)Set whether the piston is pulling or pushing blocks- Parameters:
action
- PULLING or PUSHING or CANCELED_MID_PUSH
-
setAction
public void setAction(com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValueType action, it.unimi.dsi.fastutil.objects.Object2IntMap<com.nukkitx.math.vector.Vector3i> attachedBlocks) -
updateMovement
public void updateMovement()Update the position of the piston head, moving blocks, and players. -
updateBlocks
public void updateBlocks()Place attached blocks in their final position when done pushing or pulling -
pushPlayer
public void pushPlayer()Push the player If the player is pushed, the displacement is added to playerDisplacement in PistonCache If the player contacts a slime block, playerMotion in PistonCache is updated -
computeCollisionOffset
public double computeCollisionOffset(com.nukkitx.math.vector.Vector3i blockPos, BoundingBox boundingBox, Axis axis, double movement)Compute the maximum movement of a bounding box that won't collide with the moving block attached to this piston- Parameters:
blockPos
- The position of the moving blockboundingBox
- The bounding box of the moving entityaxis
- The axis of movementmovement
- The movement in the axis- Returns:
- The adjusted movement
-
checkCollision
-
isDone
public boolean isDone()- Returns:
- True if the piston has finished its movement, otherwise false
-
canBeRemoved
public boolean canBeRemoved() -
buildStaticPistonTag
public static com.nukkitx.nbt.NbtMap buildStaticPistonTag(com.nukkitx.math.vector.Vector3i position, boolean extended, boolean sticky)Create a piston data tag that has fully extended/retracted- Parameters:
position
- The position for the base of the pistonextended
- Whether the piston is extended or retractedsticky
- Whether the piston is a sticky piston or a regular piston- Returns:
- A piston data tag for a fully extended/retracted piston
-
getPosition
public com.nukkitx.math.vector.Vector3i getPosition() -
getAction
public com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValueType getAction()
-