From 697a64efbb5c8361018bc8bb3a1653e4b948e5ca Mon Sep 17 00:00:00 2001 From: Runemoro Date: Fri, 20 Apr 2018 16:18:36 -0400 Subject: [PATCH] Fix rift registry not unloading when changing worlds --- .../dimdev/dimdoors/shared/rifts/registry/RiftRegistry.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/dimdev/dimdoors/shared/rifts/registry/RiftRegistry.java b/src/main/java/org/dimdev/dimdoors/shared/rifts/registry/RiftRegistry.java index e197f04d..e03c89cf 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/rifts/registry/RiftRegistry.java +++ b/src/main/java/org/dimdev/dimdoors/shared/rifts/registry/RiftRegistry.java @@ -56,7 +56,7 @@ public class RiftRegistry extends WorldSavedData { @Override public void readFromNBT(NBTTagCompound nbt) { dim = currentDim; - if (riftRegistry.subregistries.get(dim) != null) return; + if (riftRegistry == null || riftRegistry.subregistries.get(dim) != null) return; // Read rifts in this dimension NBTTagList riftsNBT = (NBTTagList) nbt.getTag("rifts"); @@ -154,7 +154,6 @@ public class RiftRegistry extends WorldSavedData { @Override public void readFromNBT(NBTTagCompound nbt) { - riftRegistry = this; // Trigger the subregistry reading code for all dimensions. It would be better if there was some way of forcing // them to be read from somewhere else, since this is technically more than just reading the NBT and can cause @@ -163,6 +162,7 @@ public class RiftRegistry extends WorldSavedData { // TODO: If non-dirty but new WorldSavedDatas aren't automatically saved, then create the subregistries here // TODO: rather then in the markSubregistryDirty method. // TODO: try to get rid of this code: + riftRegistry = this; for (int dim : DimensionManager.getStaticDimensionIDs()) { MapStorage storage = WorldUtils.getWorld(dim).getPerWorldStorage(); currentDim = dim; @@ -172,6 +172,7 @@ public class RiftRegistry extends WorldSavedData { subregistries.put(dim, instance); } } + riftRegistry = null; // Read player to rift maps (this has to be done after the uuidMap has been filled by the subregistry code) lastPrivatePocketEntrances = readPlayerRiftPointers((NBTTagList) nbt.getTag("lastPrivatePocketEntrances"));