added option to disable pathfinding updates on block changes (#5123)

This commit is contained in:
Lukas Alt 2021-01-30 16:34:38 +01:00 committed by GitHub
parent b67081fd72
commit ffff53fa7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,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 ac96011d4e104c99bb37833d91b8121f03b9d349..0776e68340b0510cc99084bea80791d562dfea40 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/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index fdf6380bb95fd5d82842f69411ba440b520f82ca..2b94c195db43d8e7fd58301a33377e87daa16e98 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1571,6 +1571,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);
@@ -1588,6 +1589,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
this.tickingEntities = wasTicking; // Paper
}
+ } // Paper
}
@Override