@SubscribeEvent public void clearOnUnload(WorldEvent.Unload evt) { PylonFinder.stopAllSearches(); int dim = evt.world.provider.dimensionId; ChromatiCraft.logger.debug("Unloading dimension " + dim + ", clearing crystal network."); try { this.clear(dim); for (WorldLocation c : tiles.keySet()) { CrystalNetworkTile te = tiles.get(c); PylonFinder.removePathsWithTile(te); if (te instanceof CrystalTransmitter) ((CrystalTransmitter) te).clearTargets(true); } tiles.removeWorld(evt.world); for (TileEntityCache c : pylons.values()) c.removeWorld(evt.world); } catch (ConcurrentModificationException e) { ChromatiCraft.logger.logError( "Clearing the crystal network on world unload caused a CME. This is indicative of a deeper problem."); e.printStackTrace(); } }