Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/Spigot-Server-Patches/0646-Remove-stale-POIs.patch

57 Zeilen
3.3 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/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index 4a87b9ebc2a584d8a2fca874342057e81fbbc1c6..bf9bf8368b345bf0ac3b14a08e8342f7bd63dead 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 {
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(() -> {
@@ -2085,6 +2093,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();
}
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
2021-03-16 14:04:28 +01:00
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
2021-03-16 14:04:28 +01:00
@@ -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);
}
2021-03-16 14:04:28 +01:00
@@ -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);