PaperMC/paper-server/nms-patches/net/minecraft/world/level/entity/PersistentEntitySectionManager.patch
CraftBukkit/Spigot c8ef43f1b5 SPIGOT-6722: Close entity manager when unloading world
By: DerFrZocker <derrieple@gmail.com>
2021-08-27 19:14:09 +10:00

89 lines
3.7 KiB
Diff

--- a/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
+++ b/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
@@ -82,7 +82,7 @@
long i = SectionPosition.c(t0.getChunkCoordinates());
EntitySection<T> entitysection = this.sectionStorage.c(i);
- entitysection.a((Object) t0);
+ entitysection.a(t0); // CraftBukkit - decompile error
t0.a(new PersistentEntitySectionManager.a(t0, i, entitysection));
if (!flag) {
this.callbacks.f(t0);
@@ -254,13 +254,13 @@
}
private void f() {
- this.chunksToUnload.removeIf((i) -> {
+ this.chunksToUnload.removeIf((java.util.function.LongPredicate) (i) -> { // CraftBukkit - decompile error
return this.chunkVisibility.get(i) != Visibility.HIDDEN ? true : this.d(i);
});
}
private void g() {
- ChunkEntities chunkentities;
+ ChunkEntities<T> chunkentities; // CraftBukkit - decompile error
while ((chunkentities = (ChunkEntities) this.loadingInbox.poll()) != null) {
chunkentities.b().forEach((entityaccess) -> {
@@ -292,7 +292,7 @@
}
public void b() {
- this.h().forEach((i) -> {
+ this.h().forEach((java.util.function.LongConsumer) (i) -> { // CraftBukkit - decompile error
boolean flag = this.chunkVisibility.get(i) == Visibility.HIDDEN;
if (flag) {
@@ -311,7 +311,7 @@
while (!longset.isEmpty()) {
this.permanentStorage.a(false);
this.g();
- longset.removeIf((i) -> {
+ longset.removeIf((java.util.function.LongPredicate) (i) -> { // CraftBukkit - decompile error
boolean flag = this.chunkVisibility.get(i) == Visibility.HIDDEN;
return flag ? this.d(i) : this.a(i, (entityaccess) -> {
@@ -323,7 +323,15 @@
}
public void close() throws IOException {
- this.c();
+ // CraftBukkit start - add save boolean
+ close(true);
+ }
+
+ public void close(boolean save) throws IOException {
+ if (save) {
+ this.c(); // PAIL rename saveAll
+ }
+ // CraftBukkit end
this.permanentStorage.close();
}
@@ -350,7 +358,7 @@
public void a(Writer writer) throws IOException {
CSVWriter csvwriter = CSVWriter.a().a("x").a("y").a("z").a("visibility").a("load_status").a("entity_count").a(writer);
- this.sectionStorage.a().forEach((i) -> {
+ this.sectionStorage.a().forEach((java.util.function.LongConsumer) (i) -> { // CraftBukkit - decompile error
PersistentEntitySectionManager.b persistententitysectionmanager_b = (PersistentEntitySectionManager.b) this.chunkLoadStatuses.get(i);
this.sectionStorage.a(i).forEach((j) -> {
@@ -389,7 +397,7 @@
private EntitySection<T> currentSection;
a(EntityAccess entityaccess, long i, EntitySection entitysection) {
- this.entity = entityaccess;
+ this.entity = (T) entityaccess; // CraftBukkit - decompile error
this.currentSectionKey = i;
this.currentSection = entitysection;
}
@@ -409,7 +417,7 @@
PersistentEntitySectionManager.this.a(this.currentSectionKey, this.currentSection);
EntitySection<T> entitysection = PersistentEntitySectionManager.this.sectionStorage.c(i);
- entitysection.a((Object) this.entity);
+ entitysection.a(this.entity); // CraftBukkit - decompile error
this.currentSection = entitysection;
this.currentSectionKey = i;
this.a(visibility, entitysection.c());