mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-07-02 13:04:18 +00:00
refactor: remove heap-allocated AABBs
This commit is contained in:
@@ -27,7 +27,7 @@ Throwable::Throwable(Level* level) : Entity(level) {
|
||||
void Throwable::defineSynchedData() {}
|
||||
|
||||
bool Throwable::shouldRenderAtSqrDistance(double distance) {
|
||||
double size = bb->getSize() * 4;
|
||||
double size = bb.getSize() * 4;
|
||||
size *= 64.0f;
|
||||
return distance < size * size;
|
||||
}
|
||||
@@ -147,7 +147,7 @@ void Throwable::tick() {
|
||||
|
||||
if (!level->isClientSide) {
|
||||
std::shared_ptr<Entity> hitEntity = nullptr;
|
||||
AABB grown = bb->expand(xd, yd, zd).grow(1, 1, 1);
|
||||
AABB grown = bb.expand(xd, yd, zd).grow(1, 1, 1);
|
||||
std::vector<std::shared_ptr<Entity> >* objects =
|
||||
level->getEntities(shared_from_this(), &grown);
|
||||
double nearest = 0;
|
||||
@@ -157,7 +157,7 @@ void Throwable::tick() {
|
||||
if (!e->isPickable() || (e == owner && flightTime < 5)) continue;
|
||||
|
||||
float rr = 0.3f;
|
||||
AABB bb = e->bb->grow(rr, rr, rr);
|
||||
AABB bb = e->bb.grow(rr, rr, rr);
|
||||
HitResult* p = bb.clip(from, to);
|
||||
if (p != NULL) {
|
||||
double dd = from.distanceTo(p->pos);
|
||||
|
||||
Reference in New Issue
Block a user