Class BlockCollision
java.lang.Object
org.geysermc.connector.network.translators.collision.translators.BlockCollision
- Direct Known Subclasses:
DirtPathCollision,DoorCollision,OtherCollision,ScaffoldingCollision,SnowCollision,SolidCollision,TrapdoorCollision
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BoundingBox[]protected ThreadLocal<com.nukkitx.math.vector.Vector3i>protected ThreadLocal<com.nukkitx.math.vector.Vector3d>Store a Vector3d to allow the collision to be offset by a fractional amount This is used only incheckIntersection(BoundingBox)andcomputeCollisionOffset(BoundingBox, Axis, double)protected doubleThis is used to control the maximum distance a face of a bounding box can push the player awayprotected doubleThis is used for the step up logic. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbeforeCorrectPosition(BoundingBox playerCollision)Overridden in classes like SnowCollision and GrassPathCollision when correction code needs to be run before the main correctionbooleancheckIntersection(BoundingBox playerCollision)doublecomputeCollisionOffset(BoundingBox boundingBox, Axis axis, double offset)booleancorrectPosition(GeyserSession session, BoundingBox playerCollision)Returns false if the movement is invalid, and in this case it shouldn't be sent to the server and should be cancelled While the Java server should do this, it could result in false flags by anticheat This functionality is currently only used in 6 or 7 layer snowvoidreset()voidsetPosition(com.nukkitx.math.vector.Vector3i newPosition)voidsetPositionOffset(com.nukkitx.math.vector.Vector3d newOffset)
-
Field Details
-
boundingBoxes
-
position
-
positionOffset
Store a Vector3d to allow the collision to be offset by a fractional amount This is used only incheckIntersection(BoundingBox)andcomputeCollisionOffset(BoundingBox, Axis, double) -
pushUpTolerance
protected double pushUpToleranceThis is used for the step up logic. Usually, the player can only step up a block if they are on the same Y level as its bottom face or higher For snow layers, due to its beforeCorrectPosition method the player can be slightly below (0.125 blocks) and still need to step up This used to be 0 but for now this has been set to 1 as it fixes bed collision I didn't just set it for beds because other collision may also be slightly raised off the ground. If this causes any problems, change this back to 0 and add an exception for beds. -
pushAwayTolerance
protected double pushAwayToleranceThis is used to control the maximum distance a face of a bounding box can push the player away
-
-
Constructor Details
-
BlockCollision
-
-
Method Details
-
setPosition
public void setPosition(com.nukkitx.math.vector.Vector3i newPosition) -
setPositionOffset
public void setPositionOffset(com.nukkitx.math.vector.Vector3d newOffset) -
reset
public void reset() -
beforeCorrectPosition
Overridden in classes like SnowCollision and GrassPathCollision when correction code needs to be run before the main correction -
correctPosition
Returns false if the movement is invalid, and in this case it shouldn't be sent to the server and should be cancelled While the Java server should do this, it could result in false flags by anticheat This functionality is currently only used in 6 or 7 layer snow -
checkIntersection
-
computeCollisionOffset
-