mirror of
https://github.com/GeyserMC/Geyser.git
synced 2026-01-06 15:41:50 +00:00
If it works, don't change it, move this outside the loop.
This commit is contained in:
@@ -54,17 +54,15 @@ public class BlockCollision {
|
||||
*/
|
||||
public void correctPosition(GeyserSession session, int x, int y, int z, BoundingBox playerCollision) {
|
||||
final double collisionExpansion = CollisionManager.COLLISION_TOLERANCE * 2;
|
||||
// Make player collision slightly bigger to pick up on blocks that could cause problems with NoCheatPlus's Passable check.
|
||||
playerCollision.expand(collisionExpansion, 0, collisionExpansion);
|
||||
|
||||
// Due to floating points errors, or because of block collision difference, player could be slightly clipping into the block.
|
||||
// So we check if the player is intersecting the block, if they do then push them out. This fixes NoCheatPlus's Passable check and other anticheat checks.
|
||||
// This check doesn't allow players right up against the block, so they must be pushed slightly away. However, we should only do it if the
|
||||
// push distance is smaller than "pushAwayTolerance", we don't want to push player out when they're actually inside a block.
|
||||
for (BoundingBox boundingBox : this.boundingBoxes) {
|
||||
// Make player collision slightly bigger to pick up on blocks that could cause problems with NoCheatPlus's Passable check.
|
||||
playerCollision.expand(collisionExpansion, 0, collisionExpansion);
|
||||
|
||||
if (!boundingBox.checkIntersection(x, y, z, playerCollision)) {
|
||||
playerCollision.expand(-collisionExpansion, 0, -collisionExpansion);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -84,10 +82,10 @@ public class BlockCollision {
|
||||
boundingBox.pushOutOfBoundingBox(playerCollision, Direction.DOWN, pushAwayTolerance);
|
||||
|
||||
correctPosition(session, x, y, z, boundingBox, playerCollision);
|
||||
|
||||
// Revert back to the old collision size.
|
||||
playerCollision.expand(-collisionExpansion, 0, -collisionExpansion);
|
||||
}
|
||||
|
||||
// Revert back to the old collision size.
|
||||
playerCollision.expand(-collisionExpansion, 0, -collisionExpansion);
|
||||
}
|
||||
|
||||
protected void correctPosition(GeyserSession session, int x, int y, int z, BoundingBox blockCollision, BoundingBox playerCollision) {
|
||||
|
||||
Reference in New Issue
Block a user