Fix dim loading

This commit is contained in:
Daniel Mills 2020-11-17 21:32:11 -05:00
parent ff825b85aa
commit 6e47e4bcd2
2 changed files with 32 additions and 7 deletions

View File

@ -84,7 +84,6 @@ public class ProjectManager
return v; return v;
}); });
Iris.warn("I COUNT " + vv);
return vv; return vv;
} }

View File

@ -121,23 +121,45 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
} }
if (hint == null) { if (hint == null) {
throw new RuntimeException("Cannot find iris dimension data for world: " + world.getName() + "! FAILED"); Iris.error("Cannot find iris dimension data for world: " + world.getName() + "! Assuming overworld!");
hint = "overworld";
} }
dim = IrisDataManager.loadAnyDimension(hint); dim = IrisDataManager.loadAnyDimension(hint);
if (dim == null) { if (dim == null) {
throw new RuntimeException("Cannot find dimension: " + hint); Iris.proj.downloadSearch(new MortarSender(Bukkit.getConsoleSender(), Iris.instance.getTag()), hint, false);
dim = IrisDataManager.loadAnyDimension(hint);
if(dim == null)
{
throw new RuntimeException("Cannot find dimension: " + hint);
}
else
{
Iris.info("Download pack: " + hint);
}
} }
if (production) { if (production) {
dim = new IrisDataManager(getDataFolder(world)).getDimensionLoader().load(dim.getLoadKey()); IrisDimension od = dim;
dim = new IrisDataManager(getDataFolder(world)).getDimensionLoader().load(od.getLoadKey());
if (dim == null) { if (dim == null) {
throw new RuntimeException("Cannot find dimension: " + hint); Iris.info("Installing Iris pack " + od.getName() + " into world " + world.getName() + "...");
Iris.proj.installIntoWorld(new MortarSender(Bukkit.getConsoleSender(), Iris.instance.getTag()), od.getLoadKey(), world.getWorldFolder());
dim = new IrisDataManager(getDataFolder(world)).getDimensionLoader().load(od.getLoadKey());
if(dim == null)
{
throw new RuntimeException("Cannot find dimension: " + hint);
}
} }
} }
Iris.info(world.getName() + " is configured to generate " + dim.getName() + "!");
return dim; return dim;
} }
@ -419,8 +441,12 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
public void close() { public void close() {
J.car(art); J.car(art);
getComposite().close(); getComposite().close();
IrisWorlds.evacuate(getComposite().getWorld());
Bukkit.unloadWorld(getComposite().getWorld(), !isStudio()); if(isStudio())
{
IrisWorlds.evacuate(getComposite().getWorld());
Bukkit.unloadWorld(getComposite().getWorld(), !isStudio());
}
} }
@Override @Override