aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0686-Do-not-run-raytrace-logic-for-AIR.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0686-Do-not-run-raytrace-logic-for-AIR.patch')
-rw-r--r--patches/server/0686-Do-not-run-raytrace-logic-for-AIR.patch22
1 files changed, 22 insertions, 0 deletions
diff --git a/patches/server/0686-Do-not-run-raytrace-logic-for-AIR.patch b/patches/server/0686-Do-not-run-raytrace-logic-for-AIR.patch
new file mode 100644
index 0000000000..75ece1bf8b
--- /dev/null
+++ b/patches/server/0686-Do-not-run-raytrace-logic-for-AIR.patch
@@ -0,0 +1,22 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Spottedleaf <[email protected]>
+Date: Sun, 7 Mar 2021 13:15:04 -0800
+Subject: [PATCH] Do not run raytrace logic for AIR
+
+Saves approx. 5% for the raytrace call, as most (expensive)
+raytracing tends to go through air and returning early is an
+easy win. The remaining problems with this function
+are mostly with the block getting itself.
+
+diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java
+index bd3eb39981c1d6028804f05c21eec6127389ca40..799837c172a5f7856c78e6fe2595c575f3058a5e 100644
+--- a/src/main/java/net/minecraft/world/level/BlockGetter.java
++++ b/src/main/java/net/minecraft/world/level/BlockGetter.java
+@@ -92,6 +92,7 @@ public interface BlockGetter extends LevelHeightAccessor {
+ return BlockHitResult.miss(raytrace1.getTo(), Direction.getNearest(vec3d.x, vec3d.y, vec3d.z), BlockPos.containing(raytrace1.getTo()));
+ }
+ // Paper end
++ if (iblockdata.isAir()) return null; // Paper - optimise air cases
+ FluidState fluid = iblockdata.getFluidState(); // Paper - don't need to go to world state again
+ Vec3 vec3d = raytrace1.getFrom();
+ Vec3 vec3d1 = raytrace1.getTo();