Skip to content

Commit 697a64e

Browse files
committed
Fix rift registry not unloading when changing worlds
1 parent 54d53a4 commit 697a64e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/org/dimdev/dimdoors/shared/rifts/registry/RiftRegistry.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public RiftSubregistry(String s) {
5656

5757
@Override public void readFromNBT(NBTTagCompound nbt) {
5858
dim = currentDim;
59-
if (riftRegistry.subregistries.get(dim) != null) return;
59+
if (riftRegistry == null || riftRegistry.subregistries.get(dim) != null) return;
6060

6161
// Read rifts in this dimension
6262
NBTTagList riftsNBT = (NBTTagList) nbt.getTag("rifts");
@@ -154,7 +154,6 @@ public static RiftRegistry instance() {
154154

155155
@Override
156156
public void readFromNBT(NBTTagCompound nbt) {
157-
riftRegistry = this;
158157

159158
// Trigger the subregistry reading code for all dimensions. It would be better if there was some way of forcing
160159
// 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 void readFromNBT(NBTTagCompound nbt) {
163162
// TODO: If non-dirty but new WorldSavedDatas aren't automatically saved, then create the subregistries here
164163
// TODO: rather then in the markSubregistryDirty method.
165164
// TODO: try to get rid of this code:
165+
riftRegistry = this;
166166
for (int dim : DimensionManager.getStaticDimensionIDs()) {
167167
MapStorage storage = WorldUtils.getWorld(dim).getPerWorldStorage();
168168
currentDim = dim;
@@ -172,6 +172,7 @@ public void readFromNBT(NBTTagCompound nbt) {
172172
subregistries.put(dim, instance);
173173
}
174174
}
175+
riftRegistry = null;
175176

176177
// Read player to rift maps (this has to be done after the uuidMap has been filled by the subregistry code)
177178
lastPrivatePocketEntrances = readPlayerRiftPointers((NBTTagList) nbt.getTag("lastPrivatePocketEntrances"));

0 commit comments

Comments
 (0)