Fix CachedToAABBs when offset becomes zero

If the offset were to be undone, then it would incorrectly mark the
cache as not having an offset when it actually did.
This commit is contained in:
Spottedleaf
2023-09-19 11:40:19 -07:00
parent c7fea2e95d
commit 2b63a849d3

View File

@@ -26,12 +26,14 @@ public record CachedToAABBs(
}
public static CachedToAABBs offset(final CachedToAABBs cache, final double offX, final double offY, final double offZ) {
if (offX == 0.0 && offY == 0.0 && offZ == 0.0) {
return cache;
}
final double resX = cache.offX + offX;
final double resY = cache.offY + offY;
final double resZ = cache.offZ + offZ;
final boolean isOffset = resX != 0.0 || resY != 0.0 || resZ != 0.0;
return new CachedToAABBs(cache.aabbs, isOffset, resX, resY, resZ);
return new CachedToAABBs(cache.aabbs, true, resX, resY, resZ);
}
}