refactor: remove heap-allocated AABBs

This commit is contained in:
orng
2026-03-28 02:58:56 -05:00
parent e48a05bb8f
commit 7101d03c6a
88 changed files with 353 additions and 387 deletions

View File

@@ -272,7 +272,7 @@ void PlayerConnection::handleMovePlayer(
*/
float r = 1 / 16.0f;
AABB shrunk = player->bb->shrink(r, r, r);
AABB shrunk = player->bb.shrink(r, r, r);
bool oldOk =
level->getCubes(player, &shrunk)
->empty();
@@ -326,7 +326,7 @@ void PlayerConnection::handleMovePlayer(
player->absMoveTo(xt, yt, zt, yRotT, xRotT);
// TODO: check if this can be elided
shrunk = player->bb->shrink(r, r, r);
shrunk = player->bb.shrink(r, r, r);
bool newOk =
level->getCubes(player, &shrunk)
->empty();
@@ -334,7 +334,7 @@ void PlayerConnection::handleMovePlayer(
teleport(xLastOk, yLastOk, zLastOk, yRotT, xRotT);
return;
}
AABB testBox = (*player->bb).grow(r, r, r).expand(0, -0.55, 0);
AABB testBox = player->bb.grow(r, r, r).expand(0, -0.55, 0);
// && server.level.getCubes(player, testBox).size() == 0
if (!server->isFlightAllowed() && !player->gameMode->isCreative() &&
!level->containsAnyBlocks(&testBox) && !player->isAllowedToFly()) {