<patchGroups>
	<dontLoadSpawn>
		<class id="net.minecraftforge.common.DimensionManager">
			<replaceMethod code="return false;">shouldLoadSpawn</replaceMethod>
			<insertCodeBefore code="$1 = false;">getIDs(Z)[Ljava/lang/Integer;</insertCodeBefore>
		</class>
		<class id="net.minecraft.world.gen.ChunkProviderServer">
			<replaceMethod code="
			this.^field:ChunkProviderServer/chunksToUnload^.add(($w) me.nallar.ntweaks.Util.chunkKey($1, $2));
			">unloadChunksIfNotNearSpawn</replaceMethod>
			<replaceMethodCall code="$_ = (($1 == 0) || $proceed($$));" method="^method:ChunkProviderServer/shouldLoadSpawn^">unloadQueuedChunks</replaceMethodCall>
		</class>
	</dontLoadSpawn>
</patchGroups>

<patchGroups>
	<dontLoadSpawn>
		<class id="net.minecraftforge.common.DimensionManager">
			<replaceMethod code="return false;">shouldLoadSpawn</replaceMethod>
			<insertCodeBefore code="$1 = false;">getIDs(Z)[Ljava/lang/Integer;</insertCodeBefore>
		</class>
		<class id="net.minecraft.world.gen.ChunkProviderServer">
			<replaceMethod code="
			this.^field:ChunkProviderServer/chunksToUnload^.add(($w) me.nallar.ntweaks.Util.chunkKey($1, $2));
			">unloadChunksIfNotNearSpawn</replaceMethod>
			<replaceMethodCall code="$_ = (($1 == 0) || $proceed($$));" method="^method:ChunkProviderServer/shouldLoadSpawn^">unloadQueuedChunks</replaceMethodCall>
		</class>
	</dontLoadSpawn>
	<fixRandomThingsBugWithWorldUnloads>
		<class id="lumien.randomthings.Handler.Spectre.SpectreHandler">
			<addField field="counter" fieldClass="int" code="0"/>
			<insertCodeBefore code="{
				if (counter++ % 40 != 0) {
					return;
				}
				worldObj = net.minecraftforge.common.DimensionManager.getWorld(spectreDimensionID);
				if (worldObj == null) {
					return;
				}
			}">update</insertCodeBefore>
			<replaceMethodCall method="func_82737_E" code="$_ = 0;">update</replaceMethodCall>
		</class>
	</fixRandomThingsBugWithWorldUnloads>
</patchGroups>

Fix RandomThings crashing if the spectre world is unloaded
Fix RandomThings crashing if the spectre world is unloaded
