aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0442-Reduce-blockpos-allocation-from-pathfinding.patch
blob: 8d14eb1a058beb79a9cc4fe220c13993fa7218d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Sat, 25 Apr 2020 17:10:55 -0700
Subject: [PATCH] Reduce blockpos allocation from pathfinding


diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
index dbb6a7d950b1a6f58a845b4d399ead6eb6d4fe14..70c7c735fdd0c1b66243915622e47eab8a57e7cc 100644
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
@@ -479,7 +479,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
                             return BlockPathTypes.DANGER_FIRE;
                         }
 
-                        if (world.getFluidState(pos).is(FluidTags.WATER)) {
+                        if (blockState.getFluidState().is(FluidTags.WATER)) { // Paper - Perf: Reduce blockpos allocation from pathfinding
                             return BlockPathTypes.WATER_BORDER;
                         }
 
@@ -510,7 +510,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
                 } else if (blockState.is(Blocks.COCOA)) {
                     return BlockPathTypes.COCOA;
                 } else if (!blockState.is(Blocks.WITHER_ROSE) && !blockState.is(Blocks.POINTED_DRIPSTONE)) {
-                    FluidState fluidState = world.getFluidState(pos);
+                    FluidState fluidState = blockState.getFluidState(); // Paper - Perf: Reduce blockpos allocation from pathfinding
                     if (fluidState.is(FluidTags.LAVA)) {
                         return BlockPathTypes.LAVA;
                     } else if (isBurningBlock(blockState)) {