mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-16 09:42:58 +00:00
refactor: remove calls to Vec3::newTemp when not returned
This commit is contained in:
@@ -135,14 +135,14 @@ void Throwable::tick() {
|
||||
flightTime++;
|
||||
}
|
||||
|
||||
Vec3* from = Vec3::newTemp(x, y, z);
|
||||
Vec3* to = Vec3::newTemp(x + xd, y + yd, z + zd);
|
||||
HitResult* res = level->clip(from, to);
|
||||
Vec3 from(x, y, z);
|
||||
Vec3 to(x + xd, y + yd, z + zd);
|
||||
HitResult* res = level->clip(&from, &to);
|
||||
|
||||
from = Vec3::newTemp(x, y, z);
|
||||
to = Vec3::newTemp(x + xd, y + yd, z + zd);
|
||||
from = Vec3(x, y, z);
|
||||
to = Vec3(x + xd, y + yd, z + zd);
|
||||
if (res != NULL) {
|
||||
to = Vec3::newTemp(res->pos.x, res->pos.y, res->pos.z);
|
||||
to = Vec3(res->pos.x, res->pos.y, res->pos.z);
|
||||
}
|
||||
|
||||
if (!level->isClientSide) {
|
||||
@@ -157,9 +157,9 @@ void Throwable::tick() {
|
||||
|
||||
float rr = 0.3f;
|
||||
AABB* bb = e->bb->grow(rr, rr, rr);
|
||||
HitResult* p = bb->clip(from, to);
|
||||
HitResult* p = bb->clip(&from, &to);
|
||||
if (p != NULL) {
|
||||
double dd = from->distanceTo(p->pos);
|
||||
double dd = from.distanceTo(p->pos);
|
||||
delete p;
|
||||
if (dd < nearest || nearest == 0) {
|
||||
hitEntity = e;
|
||||
|
||||
Reference in New Issue
Block a user