Class CollisionManager
java.lang.Object
org.geysermc.geyser.level.physics.CollisionManager
-
Field Summary
Modifier and TypeFieldDescriptionstatic double
Additional space where blocks are checked, which is helpful for fixing NoCheatPlus's Passable check. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncom.nukkitx.math.vector.Vector3d
adjustBedrockPosition(com.nukkitx.math.vector.Vector3f bedrockPosition, boolean onGround, boolean teleported)
Adjust the Bedrock position before sending to the Java server to account for inaccuracies in movement between the two versions.com.nukkitx.math.vector.Vector3d
correctMovement(com.nukkitx.math.vector.Vector3d movement, BoundingBox boundingBox, boolean onGround, double stepUp, boolean checkWorld)
com.nukkitx.math.vector.Vector3d
correctPlayerMovement(com.nukkitx.math.vector.Vector3d movement, boolean checkWorld, boolean teleported)
boolean
Returns false if the movement is invalid, and in this case it shouldn't be sent to the server and should be cancelled SeeBlockCollision.correctPosition(GeyserSession, int, int, int, BoundingBox)
for more infoboolean
boolean
void
void
setOnScaffolding(boolean onScaffolding)
Whether the player is on top of scaffoldingvoid
setTouchingScaffolding(boolean touchingScaffolding)
Whether the player is inside scaffoldingvoid
Updates the height of the stored bounding boxvoid
updatePlayerBoundingBox(com.nukkitx.math.vector.Vector3d position)
Updates the stored bounding boxvoid
updatePlayerBoundingBox(com.nukkitx.math.vector.Vector3f position)
Updates the stored bounding boxvoid
updateScaffoldingFlags(boolean updateMetadata)
Updates scaffolding entity flags Scaffolding needs to be checked per-move since it's a flag in Bedrock but Java does it client-side
-
Field Details
-
COLLISION_TOLERANCE
public static final double COLLISION_TOLERANCEAdditional space where blocks are checked, which is helpful for fixing NoCheatPlus's Passable check. This check doesn't allow players right up against the block, so they must be pushed slightly away.- See Also:
- Constant Field Values
-
-
Constructor Details
-
CollisionManager
-
-
Method Details
-
updatePlayerBoundingBox
public void updatePlayerBoundingBox(com.nukkitx.math.vector.Vector3f position)Updates the stored bounding box- Parameters:
position
- The new position of the player
-
updatePlayerBoundingBox
public void updatePlayerBoundingBox(com.nukkitx.math.vector.Vector3d position)Updates the stored bounding box- Parameters:
position
- The new position of the player
-
updatePlayerBoundingBox
public void updatePlayerBoundingBox()Updates the height of the stored bounding box -
adjustBedrockPosition
public com.nukkitx.math.vector.Vector3d adjustBedrockPosition(com.nukkitx.math.vector.Vector3f bedrockPosition, boolean onGround, boolean teleported)Adjust the Bedrock position before sending to the Java server to account for inaccuracies in movement between the two versions. Will also send corrected movement packets back to Bedrock if they collide with pistons.- Parameters:
bedrockPosition
- the current Bedrock position of the clientonGround
- whether the Bedrock player is on the groundteleported
- whether the Bedrock player has teleported to a new position. If true, movement correction is skipped.- Returns:
- the position to send to the Java server, or null to cancel sending the packet
-
recalculatePosition
public void recalculatePosition() -
collidableBlocksIterator
-
playerCollidableBlocksIterator
-
correctPlayerPosition
public boolean correctPlayerPosition()Returns false if the movement is invalid, and in this case it shouldn't be sent to the server and should be cancelled SeeBlockCollision.correctPosition(GeyserSession, int, int, int, BoundingBox)
for more info -
correctPlayerMovement
public com.nukkitx.math.vector.Vector3d correctPlayerMovement(com.nukkitx.math.vector.Vector3d movement, boolean checkWorld, boolean teleported) -
correctMovement
public com.nukkitx.math.vector.Vector3d correctMovement(com.nukkitx.math.vector.Vector3d movement, BoundingBox boundingBox, boolean onGround, double stepUp, boolean checkWorld) -
isUnderSlab
public boolean isUnderSlab()- Returns:
- true if the block located at the player's floor position plus 1 would intersect with the player, were they not sneaking
-
isPlayerInWater
public boolean isPlayerInWater()- Returns:
- if the player is currently in a water block
-
updateScaffoldingFlags
public void updateScaffoldingFlags(boolean updateMetadata)Updates scaffolding entity flags Scaffolding needs to be checked per-move since it's a flag in Bedrock but Java does it client-side- Parameters:
updateMetadata
- whether we should update metadata if something changed
-
getPlayerBoundingBox
-
setTouchingScaffolding
public void setTouchingScaffolding(boolean touchingScaffolding)Whether the player is inside scaffolding -
setOnScaffolding
public void setOnScaffolding(boolean onScaffolding)Whether the player is on top of scaffolding
-