Class PistonCache
java.lang.Object
org.geysermc.geyser.session.cache.PistonCache
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckCollision(com.nukkitx.math.vector.Vector3i blockPos, BoundingBox boundingBox)voidclear()doublecomputeCollisionOffset(com.nukkitx.math.vector.Vector3i blockPos, BoundingBox boundingBox, Axis axis, double offset)voiddisplacePlayer(com.nukkitx.math.vector.Vector3d displacement)Add to the player's displacement and move the player's bounding box The total displacement is capped to a range of -0.51 to 0.51 per tickMap<com.nukkitx.math.vector.Vector3i,PistonBlockEntity>Maps the position of a moving block to the piston moving it Positions in this map represent the starting position of the blockMap<com.nukkitx.math.vector.Vector3i,PistonBlockEntity>Maps the position of a piston to its block entitycom.nukkitx.math.vector.Vector3dcom.nukkitx.math.vector.Vector3fbooleanStores whether a player is standing on a honey block.booleanStores whether a player has/will collide with any moving blocks.booleanStores whether a player has/will collide with any slime blocks.voidsetPlayerAttachedToHoney(boolean playerAttachedToHoney)Stores whether a player is standing on a honey block.voidsetPlayerCollided(boolean playerCollided)Stores whether a player has/will collide with any moving blocks.voidsetPlayerMotion(com.nukkitx.math.vector.Vector3f playerMotion)voidsetPlayerSlimeCollision(boolean playerSlimeCollision)Stores whether a player has/will collide with any slime blocks.voidtick()
-
Constructor Details
-
PistonCache
-
-
Method Details
-
tick
public void tick() -
displacePlayer
public void displacePlayer(com.nukkitx.math.vector.Vector3d displacement)Add to the player's displacement and move the player's bounding box The total displacement is capped to a range of -0.51 to 0.51 per tick- Parameters:
displacement- The displacement to apply to the player's bounding box
-
computeCollisionOffset
public double computeCollisionOffset(com.nukkitx.math.vector.Vector3i blockPos, BoundingBox boundingBox, Axis axis, double offset)- Parameters:
blockPos- The block position to testboundingBox- The bounding box that movesaxis- The axis to apply the offsetoffset- The current maximum distance the bounding box can travel- Returns:
- The new maximum distance the bounding box can travel without colliding with the tested moving block
-
checkCollision
-
clear
public void clear() -
getPistons
Maps the position of a piston to its block entity -
getMovingBlocksMap
Maps the position of a moving block to the piston moving it Positions in this map represent the starting position of the block -
getPlayerDisplacement
public com.nukkitx.math.vector.Vector3d getPlayerDisplacement() -
getPlayerMotion
public com.nukkitx.math.vector.Vector3f getPlayerMotion() -
isPlayerCollided
public boolean isPlayerCollided()Stores whether a player has/will collide with any moving blocks. -
isPlayerSlimeCollision
public boolean isPlayerSlimeCollision()Stores whether a player has/will collide with any slime blocks. This is used to prevent movement from being corrected when players are about to hit a slime block. -
isPlayerAttachedToHoney
public boolean isPlayerAttachedToHoney()Stores whether a player is standing on a honey block. This is used to ignore movement from Bedrock to prevent them from falling off. -
setPlayerMotion
public void setPlayerMotion(com.nukkitx.math.vector.Vector3f playerMotion) -
setPlayerCollided
public void setPlayerCollided(boolean playerCollided)Stores whether a player has/will collide with any moving blocks. -
setPlayerSlimeCollision
public void setPlayerSlimeCollision(boolean playerSlimeCollision)Stores whether a player has/will collide with any slime blocks. This is used to prevent movement from being corrected when players are about to hit a slime block. -
setPlayerAttachedToHoney
public void setPlayerAttachedToHoney(boolean playerAttachedToHoney)Stores whether a player is standing on a honey block. This is used to ignore movement from Bedrock to prevent them from falling off.
-