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
+3 -3
View File
@@ -83,7 +83,7 @@ std::shared_ptr<ItemInstance> BoatItem::use(
Vec3 b = player->getViewVector(a);
bool hitEntity = false;
float overlap = 1;
AABB grown = player->bb->expand(b.x * (range), b.y * (range), b.z * (range))
AABB grown = player->bb.expand(b.x * (range), b.y * (range), b.z * (range))
.grow(overlap, overlap, overlap);
std::vector<std::shared_ptr<Entity> >* objects =
level->getEntities(player, &grown);
@@ -93,7 +93,7 @@ std::shared_ptr<ItemInstance> BoatItem::use(
if (!e->isPickable()) continue;
float rr = e->getPickRadius();
AABB bb = e->bb->grow(rr, rr, rr);
AABB bb = e->bb.grow(rr, rr, rr);
if (bb.contains(from)) {
hitEntity = true;
}
@@ -116,7 +116,7 @@ std::shared_ptr<ItemInstance> BoatItem::use(
boat->yRot =
((Mth::floor(player->yRot * 4.0F / 360.0F + 0.5) & 0x3) - 1) *
90;
AABB grown = boat->bb->grow(-0.1, -0.1, -0.1);
AABB grown = boat->bb.grow(-0.1, -0.1, -0.1);
if (!level->getCubes(boat, &grown)->empty()) {
return itemInstance;
}