aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0616-added-option-to-disable-pathfinding-updates-on-block.patch
blob: 5050fb908a9b8423a85f3b6e74d02dbdd5cae01a (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
29
30
31
32
33
34
35
36
37
38
39
40
41
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: lukas81298 <lukas81298@gommehd.net>
Date: Mon, 25 Jan 2021 14:37:57 +0100
Subject: [PATCH] added option to disable pathfinding updates on block changes


diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 3e694d8a28524f9ea6ba8f1947061b92bc15b13d..843878bb83dfebca8d3574c159c5e338f15104ac 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -807,5 +807,10 @@ public class PaperWorldConfig {
     private void enderDragonsDeathAlwaysPlacesDragonEgg() {
         enderDragonsDeathAlwaysPlacesDragonEgg = getBoolean("ender-dragons-death-always-places-dragon-egg", enderDragonsDeathAlwaysPlacesDragonEgg);
     }
+
+    public boolean updatePathfindingOnBlockUpdate = true;
+    private void setUpdatePathfindingOnBlockUpdate() {
+        updatePathfindingOnBlockUpdate = getBoolean("update-pathfinding-on-block-update", this.updatePathfindingOnBlockUpdate);
+    }
 }
 
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 09474f7e973563585e102cc839ab6842a3a10c0c..e0efad2395dd889430554074bbd9769957a72687 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1386,6 +1386,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
     @Override
     public void sendBlockUpdated(BlockPos pos, BlockState oldState, BlockState newState, int flags) {
         this.getChunkSource().blockChanged(pos);
+        if(this.paperConfig.updatePathfindingOnBlockUpdate) { // Paper - option to disable pathfinding updates
         VoxelShape voxelshape = oldState.getCollisionShape(this, pos);
         VoxelShape voxelshape1 = newState.getCollisionShape(this, pos);
 
@@ -1413,6 +1414,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
             }
 
         }
+        } // Paper
     }
 
     @Override