From 72992559ca08769594d71f12c75f455c23f82f5b Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Wed, 13 Sep 2023 13:46:28 -0700 Subject: [PATCH] Change getSeenFraction to return float Vanilla uses float here, so it may change behaviorly slightly by using more precision. --- patches/server/0029-Actually-optimise-explosions.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/patches/server/0029-Actually-optimise-explosions.patch b/patches/server/0029-Actually-optimise-explosions.patch index 81c7559773..036429810b 100644 --- a/patches/server/0029-Actually-optimise-explosions.patch +++ b/patches/server/0029-Actually-optimise-explosions.patch @@ -34,7 +34,7 @@ The results indicate that this logic is 5 times faster than Vanilla and 2.3 times faster than Lithium. diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index e8c4815960ab144298d4352f393b9670e7004e62..744b9e4666aade8d84f84807900d4ee31afef7b6 100644 +index e8c4815960ab144298d4352f393b9670e7004e62..53f708a58a2b86fb81602b028a357990a632b49b 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -96,6 +96,271 @@ public class Explosion { @@ -257,7 +257,7 @@ index e8c4815960ab144298d4352f393b9670e7004e62..744b9e4666aade8d84f84807900d4ee3 + } + } + -+ private double getSeenFraction(final Vec3 source, final Entity target, ++ private float getSeenFraction(final Vec3 source, final Entity target, + final ExplosionBlockCache[] blockCache, + final BlockPos.MutableBlockPos blockPos) { + final AABB boundingBox = target.getBoundingBox(); @@ -270,7 +270,7 @@ index e8c4815960ab144298d4352f393b9670e7004e62..744b9e4666aade8d84f84807900d4ee3 + final double incZ = 1.0 / (diffZ * 2.0 + 1.0); + + if (incX < 0.0 || incY < 0.0 || incZ < 0.0) { -+ return 0.0; ++ return 0.0f; + } + + final double offX = (1.0 - Math.floor(1.0 / incX) * incX) * 0.5 + boundingBox.minX; @@ -302,7 +302,7 @@ index e8c4815960ab144298d4352f393b9670e7004e62..744b9e4666aade8d84f84807900d4ee3 + } + } + -+ return (double)missedRays / (double)totalRays; ++ return (float)missedRays / (float)totalRays; + } + // Paper end - optimise collisions +