Move world unload patch to tick function to prevent duplicate unloading, fix log message in dim manager, fix javadoc for unload method (#5964)

This commit is contained in:
ichttt 2019-07-31 01:39:05 +02:00 committed by LexManos
parent 61285a098a
commit c6dd475610
2 changed files with 8 additions and 8 deletions

View File

@ -1,13 +1,13 @@
--- a/net/minecraft/world/server/ChunkManager.java --- a/net/minecraft/world/server/ChunkManager.java
+++ b/net/minecraft/world/server/ChunkManager.java +++ b/net/minecraft/world/server/ChunkManager.java
@@ -385,6 +385,7 @@ @@ -362,6 +362,7 @@
while((p_223155_1_.getAsBoolean() || this.field_223181_A.size() > 2000) && (runnable = this.field_223181_A.poll()) != null) { iprofiler.func_219895_b("chunk_unload");
runnable.run(); if (!this.field_219255_i.func_217402_u()) {
this.func_223155_b(p_219204_1_);
+ if (this.field_219251_e.isEmpty()) net.minecraftforge.common.DimensionManager.unloadWorld(this.field_219255_i);
} }
+ if (this.field_219251_e.isEmpty()) net.minecraftforge.common.DimensionManager.unloadWorld(this.field_219255_i);
}
iprofiler.func_76319_b();
@@ -398,6 +399,7 @@ @@ -398,6 +399,7 @@
if (this.field_219253_g.remove(p_219212_1_, p_219212_3_) && p_219185_5_ != null) { if (this.field_219253_g.remove(p_219212_1_, p_219212_3_) && p_219185_5_ != null) {
if (p_219185_5_ instanceof Chunk) { if (p_219185_5_ instanceof Chunk) {

View File

@ -227,7 +227,7 @@ public class DimensionManager
/** /**
* Queues a dimension to unload, if it can be unloaded. * Queues a dimension to unload, if it can be unloaded.
* @param id The id of the dimension * @param world The world to unload
*/ */
public static void unloadWorld(ServerWorld world) public static void unloadWorld(ServerWorld world)
{ {
@ -372,7 +372,7 @@ public class DimensionManager
ModDimension mod = ForgeRegistries.MOD_DIMENSIONS.getValue(entry.type); ModDimension mod = ForgeRegistries.MOD_DIMENSIONS.getValue(entry.type);
if (mod == null) if (mod == null)
{ {
LOGGER.error(DIMMGR, "Modded dimension entry '{}' id {} in save file missing ModDimension.", entry.name.toString(), entry.id, entry.type.toString()); LOGGER.error(DIMMGR, "Modded dimension entry '{}' id {} type {} in save file missing ModDimension.", entry.name.toString(), entry.id, entry.type.toString());
savedEntries.put(entry.name, entry); savedEntries.put(entry.name, entry);
continue; continue;
} }