aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0667-added-option-to-disable-pathfinding-updates-on-block.patch
blob: a23610ad94d968f539ccdbf3b2c4c6587fa64787 (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
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 1ceacb6bbfe99069763845a8aef48a3fb4841e32..d2f6e1308a4dfec663770e2c7f4de0cf22402a97 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -799,4 +799,9 @@ 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/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index be7f210bd8be1e393c0c449274ff1a1b030d660e..ef9b08df58d9d28df6b8ade076d95bf7e5cb1b18 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -1685,6 +1685,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
     @Override
     public void notify(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1, int i) {
         this.getChunkProvider().flagDirty(blockposition);
+        if(this.paperConfig.updatePathfindingOnBlockUpdate) { // Paper - option to disable pathfinding updates
         VoxelShape voxelshape = iblockdata.getCollisionShape(this, blockposition);
         VoxelShape voxelshape1 = iblockdata1.getCollisionShape(this, blockposition);
 
@@ -1713,6 +1714,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
 
             this.tickingEntities = wasTicking; // Paper
         }
+        } // Paper
     }
 
     @Override