3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/Spigot-Server-Patches/0646-Remove-stale-POIs.patch
Shane Freeder e886d8118e
Updated Upstream ()
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
2021-02-06 00:00:18 +00:00

57 Zeilen
3.2 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/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java
index b926cebd053bef829517c9d9bbf1c609c23ca04a..6a0f07b13eef5560dfc7c7b39618c0b825533aec 100644
--- a/src/main/java/net/minecraft/server/VillagePlace.java
+++ b/src/main/java/net/minecraft/server/VillagePlace.java
@@ -41,6 +41,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);
}
@@ -125,6 +126,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);
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 91d759fee68e8b285f912406fb338750c286f6a0..fbe7f43f6c1010e7a34114f8afb0e64934744335 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1942,8 +1942,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(() -> {
@@ -1960,6 +1968,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
}
}
+ public final VillagePlace getPoiStorage() { return this.y(); } // Paper - OBFHELPER
public VillagePlace y() {
return this.getChunkProvider().j();
}