2021-01-09 14:19:17 +01:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Shane Freeder <theboyetronic@gmail.com>
|
|
|
|
Date: Sat, 9 Jan 2021 14:17:07 +0100
|
|
|
|
Subject: [PATCH] Remove stale POIs
|
|
|
|
|
|
|
|
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
|
|
|
|
index ae2cb0139e71ff41cfac9346179f1037a4401fa1..0bd2ce4f27182c4190892c0a20ab6d99727f27b9 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
|
|
|
|
@@ -2062,8 +2062,16 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
2021-01-09 14:19:17 +01:00
|
|
|
Optional<VillagePlaceType> optional = VillagePlaceType.b(iblockdata);
|
|
|
|
Optional<VillagePlaceType> optional1 = VillagePlaceType.b(iblockdata1);
|
|
|
|
|
|
|
|
+ // Paper start
|
2021-01-10 19:36:38 +01:00
|
|
|
+ BlockPosition blockposition1 = blockposition.immutableCopy();
|
2021-01-09 14:32:26 +01:00
|
|
|
+ this.getMinecraftServer().execute(() -> {
|
2021-01-10 19:36:38 +01:00
|
|
|
+ if (!optional.isPresent() && this.getPoiStorage().test(blockposition1, com.google.common.base.Predicates.alwaysTrue())) {
|
|
|
|
+ this.getPoiStorage().remove(blockposition1);
|
2021-01-09 14:32:26 +01:00
|
|
|
+ }
|
|
|
|
+ });
|
2021-01-09 14:19:17 +01:00
|
|
|
if (!Objects.equals(optional, optional1)) {
|
2021-01-10 19:36:38 +01:00
|
|
|
- BlockPosition blockposition1 = blockposition.immutableCopy();
|
|
|
|
+ //BlockPosition blockposition1 = blockposition.immutableCopy();
|
|
|
|
+ // Paper end
|
2021-01-09 14:19:17 +01:00
|
|
|
|
2021-01-10 19:36:38 +01:00
|
|
|
optional.ifPresent((villageplacetype) -> {
|
|
|
|
this.getMinecraftServer().execute(() -> {
|
2021-03-16 08:19:45 +01:00
|
|
|
@@ -2080,6 +2088,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
2021-01-09 14:19:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ public final VillagePlace getPoiStorage() { return this.y(); } // Paper - OBFHELPER
|
|
|
|
public VillagePlace y() {
|
|
|
|
return this.getChunkProvider().j();
|
|
|
|
}
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java
|
|
|
|
index 6f3f968b30fdc210e47cb8d99139173869df1638..69e0fce81e4a5d538e6e2e04e251f0b24192f324 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java
|
|
|
|
@@ -52,6 +52,7 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
|
|
|
((VillagePlaceSection) this.e(SectionPosition.a(blockposition).s())).a(blockposition, villageplacetype);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ public void remove(BlockPosition blockposition) { this.a(blockposition); } // Paper - OBFHELPER
|
|
|
|
public void a(BlockPosition blockposition) {
|
|
|
|
((VillagePlaceSection) this.e(SectionPosition.a(blockposition).s())).a(blockposition);
|
|
|
|
}
|
|
|
|
@@ -136,6 +137,7 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
|
|
|
return ((VillagePlaceSection) this.e(SectionPosition.a(blockposition).s())).c(blockposition);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ public final boolean test(BlockPosition blockposition, Predicate<VillagePlaceType> predicate) { return this.a(blockposition, predicate); } // Paper - OBFHELPER
|
|
|
|
public boolean a(BlockPosition blockposition, Predicate<VillagePlaceType> predicate) {
|
|
|
|
return (Boolean) this.d(SectionPosition.a(blockposition).s()).map((villageplacesection) -> {
|
|
|
|
return villageplacesection.a(blockposition, predicate);
|