Class BlockCollision

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

public class BlockCollision extends Object
  • Field Details

    • boundingBoxes

      protected final BoundingBox[] boundingBoxes
    • 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

    • beforeCorrectPosition

      public void beforeCorrectPosition(int x, int y, int z, 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, int x, int y, int z, 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(double x, double y, double z, BoundingBox playerCollision)
    • checkIntersection

      public boolean checkIntersection(com.nukkitx.math.vector.Vector3i position, BoundingBox playerCollision)
    • computeCollisionOffset

      public double computeCollisionOffset(double x, double y, double z, BoundingBox boundingBox, Axis axis, double offset)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getBoundingBoxes

      public BoundingBox[] getBoundingBoxes()