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;
});
Iris.warn("I COUNT " + vv);
return vv;
}

View File

@ -121,22 +121,44 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
}
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);
if (dim == null) {
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) {
dim = new IrisDataManager(getDataFolder(world)).getDimensionLoader().load(dim.getLoadKey());
IrisDimension od = dim;
dim = new IrisDataManager(getDataFolder(world)).getDimensionLoader().load(od.getLoadKey());
if (dim == null) {
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;
}
@ -419,9 +441,13 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
public void close() {
J.car(art);
getComposite().close();
if(isStudio())
{
IrisWorlds.evacuate(getComposite().getWorld());
Bukkit.unloadWorld(getComposite().getWorld(), !isStudio());
}
}
@Override
public boolean isClosed() {