From a9525a6f71e4efedaac60a27dc302b7f82fdff0e Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Wed, 21 Apr 2021 20:04:42 +0100 Subject: [PATCH] Do not schedule poi task for each block write on chunk gen Most of the time optional == optional1, so we shouldn't schedule a task for each write. --- .../0645-Remove-stale-POIs.patch | 32 ++++++++----------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/Spigot-Server-Patches/0645-Remove-stale-POIs.patch b/Spigot-Server-Patches/0645-Remove-stale-POIs.patch index 0984ac1923..05bd91ba67 100644 --- a/Spigot-Server-Patches/0645-Remove-stale-POIs.patch +++ b/Spigot-Server-Patches/0645-Remove-stale-POIs.patch @@ -5,28 +5,22 @@ Subject: [PATCH] Remove stale POIs diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java -index 4a87b9ebc2a584d8a2fca874342057e81fbbc1c6..bf9bf8368b345bf0ac3b14a08e8342f7bd63dead 100644 +index 4a87b9ebc2a584d8a2fca874342057e81fbbc1c6..c38ef337f9a662d689994a0d530e8e655b843177 100644 --- a/src/main/java/net/minecraft/server/level/WorldServer.java +++ b/src/main/java/net/minecraft/server/level/WorldServer.java -@@ -2067,8 +2067,16 @@ public class WorldServer extends World implements GeneratorAccessSeed { - Optional optional = VillagePlaceType.b(iblockdata); - Optional optional1 = VillagePlaceType.b(iblockdata1); - -+ // Paper start -+ BlockPosition blockposition1 = blockposition.immutableCopy(); -+ this.getMinecraftServer().execute(() -> { -+ if (!optional.isPresent() && this.getPoiStorage().test(blockposition1, com.google.common.base.Predicates.alwaysTrue())) { -+ this.getPoiStorage().remove(blockposition1); -+ } -+ }); - if (!Objects.equals(optional, optional1)) { -- BlockPosition blockposition1 = blockposition.immutableCopy(); -+ //BlockPosition blockposition1 = blockposition.immutableCopy(); -+ // Paper end - - optional.ifPresent((villageplacetype) -> { +@@ -2078,6 +2078,11 @@ public class WorldServer extends World implements GeneratorAccessSeed { + }); + optional1.ifPresent((villageplacetype) -> { this.getMinecraftServer().execute(() -> { -@@ -2085,6 +2093,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { ++ // Paper start ++ if (!optional.isPresent() && this.getPoiStorage().test(blockposition1, com.google.common.base.Predicates.alwaysTrue())) { ++ this.getPoiStorage().remove(blockposition1); ++ } ++ // Paper end + this.y().a(blockposition1, villageplacetype); + PacketDebug.a(this, blockposition1); + }); +@@ -2085,6 +2090,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } }