Created
December 11, 2018 14:04
-
-
Save takarabako/efdde27e0e289d0c73de3d4caf6c2c7f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.../mod/mixin/core/forge/MixinDimensionManager.java | 18 ++++++++++++++++-- | |
1 file changed, 16 insertions(+), 2 deletions(-) | |
diff --git a/src/main/java/org/spongepowered/mod/mixin/core/forge/MixinDimensionManager.java b/src/main/java/org/spongepowered/mod/mixin/core/forge/MixinDimensionManager.java | |
index ced3ba6d..fdea4318 100644 | |
--- a/src/main/java/org/spongepowered/mod/mixin/core/forge/MixinDimensionManager.java | |
+++ b/src/main/java/org/spongepowered/mod/mixin/core/forge/MixinDimensionManager.java | |
@@ -67,6 +67,7 @@ | |
public abstract class MixinDimensionManager { | |
@Shadow @Final @Mutable private static Multiset<Integer> leakedWorlds = HashMultiset.create(); | |
+ private static Hashtable<Integer, WorldServer> backupWorldTable = new Hashtable<Integer, WorldServer>(); | |
/** | |
* @author Zidane, blood | |
@@ -190,7 +191,18 @@ public static WorldProvider getProvider(int dim) { | |
@SuppressWarnings("deprecation") | |
@Overwrite | |
public static void setWorld(int id, WorldServer world, MinecraftServer server) { | |
- if (world != null) { | |
+ if (world != null) | |
+ { | |
+ backupWorldTable.put(id, world); | |
+ } | |
+ else | |
+ { | |
+ backupWorldTable.remove(id); | |
+ } | |
+ | |
+ //The following code is suppose to be handled by WorldManager so we don't need it any more? | |
+ /* | |
+ if (world != null) { | |
WorldManager.forceAddWorld(id, world); | |
server.worldTickTimes.put(id, new long[100]); | |
FMLLog.info("Loading dimension %d (%s) (%s)", id, world.getWorldInfo().getWorldName(), world.getMinecraftServer()); | |
@@ -203,6 +215,7 @@ public static void setWorld(int id, WorldServer world, MinecraftServer server) { | |
} | |
WorldManager.reorderWorldsVanillaFirst(); | |
+ */ | |
} | |
/** | |
@@ -273,7 +286,8 @@ public static void initDimension(int dim) { | |
*/ | |
@Overwrite | |
public static WorldServer getWorld(int id) { | |
- return WorldManager.getWorldByDimensionId(id).orElse(null); | |
+ WorldServer world = WorldManager.getWorldByDimensionId(id).orElse(null); | |
+ return world != null ? world : backupWorldTable.get(id); | |
} | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.../java/org/spongepowered/mod/mixin/core/world/MixinWorldServer.java | 4 ++-- | |
1 file changed, 2 insertions(+), 2 deletions(-) | |
diff --git a/src/main/java/org/spongepowered/mod/mixin/core/world/MixinWorldServer.java b/src/main/java/org/spongepowered/mod/mixin/core/world/MixinWorldServer.java | |
index 56af92ca..2d81ce89 100644 | |
--- a/src/main/java/org/spongepowered/mod/mixin/core/world/MixinWorldServer.java | |
+++ b/src/main/java/org/spongepowered/mod/mixin/core/world/MixinWorldServer.java | |
@@ -62,7 +62,7 @@ | |
public Integer getDimensionId() { | |
return this.provider.getDimension(); | |
} | |
- | |
+/* | |
@Redirect( | |
method = "<init>", | |
at = @At( | |
@@ -74,7 +74,7 @@ public Integer getDimensionId() { | |
private void redirectSetWorld(int id, WorldServer world, MinecraftServer server) { | |
// Handled by WorldManager | |
} | |
- | |
+*/ | |
/** | |
* @author gabizou - May 23rd, 2018 | |
* @reason - Even though Dedicated server does handle this change, I'm inlining the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment