mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-03 06:40:19 +08:00
57 lines
3.3 KiB
Diff
57 lines
3.3 KiB
Diff
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
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
|
|
index 595194e0a0e746c45e3766433bb827b7b51129b5..5da7d1df97e70248d01cb1c452b26cfba415a5b0 100644
|
|
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
|
|
@@ -2066,8 +2066,16 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
|
Optional<VillagePlaceType> optional = VillagePlaceType.b(iblockdata);
|
|
Optional<VillagePlaceType> 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) -> {
|
|
this.getMinecraftServer().execute(() -> {
|
|
@@ -2084,6 +2092,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
|
}
|
|
}
|
|
|
|
+ public final VillagePlace getPoiStorage() { return this.y(); } // Paper - OBFHELPER
|
|
public VillagePlace y() {
|
|
return this.getChunkProvider().j();
|
|
}
|
|
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 04b01cb841dc4f34ded5aaa4ea7a8e6d4b470183..ce165233739c7b92a76031b949f269bd0a11149c 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
|
|
@@ -54,6 +54,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);
|
|
}
|
|
@@ -138,6 +139,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);
|