java.lang.Object
org.geysermc.connector.network.translators.collision.translators.BlockCollision
Direct Known Subclasses:
DirtPathCollision, DoorCollision, OtherCollision, ScaffoldingCollision, SnowCollision, SolidCollision, TrapdoorCollision

public class BlockCollision extends Object
  • Field Details

    • boundingBoxes

      protected final BoundingBox[] boundingBoxes
    • position

      protected final ThreadLocal<com.nukkitx.math.vector.Vector3i> position
    • positionOffset

      protected final ThreadLocal<com.nukkitx.math.vector.Vector3d> positionOffset
      Store a Vector3d to allow the collision to be offset by a fractional amount This is used only in checkIntersection(BoundingBox) and computeCollisionOffset(BoundingBox, Axis, double)
    • pushUpTolerance

      protected double pushUpTolerance
      This 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 pushAwayTolerance
      This is used to control the maximum distance a face of a bounding box can push the player away
  • Constructor Details

    • BlockCollision

      protected BlockCollision(BoundingBox[] boxes)
  • 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

      public void beforeCorrectPosition(BoundingBox playerCollision)
      Overridden in classes like SnowCollision and GrassPathCollision when correction code needs to be run before the main correction
    • correctPosition

      public boolean correctPosition(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 snow
    • checkIntersection

      public boolean checkIntersection(BoundingBox playerCollision)
    • computeCollisionOffset

      public double computeCollisionOffset(BoundingBox boundingBox, Axis axis, double offset)