3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 19:10:09 +01:00
Paper/Spigot-Server-Patches/0647-Remove-stale-POIs.patch

57 Zeilen
3.2 KiB
Diff

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
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
2021-02-21 21:55:01 +01:00
index 493e3cd8a3dbc77f73dd1e026c9e580896995675..53d3e1561ea33c38de5dc5dde181439153fa2775 100644
2021-01-09 14:19:17 +01:00
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
2021-02-21 21:55:01 +01:00
@@ -1953,8 +1953,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();
+ 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: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-02-21 21:55:01 +01:00
@@ -1971,6 +1979,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();
}