dont set failed pack

This commit is contained in:
dfsek 2021-12-29 02:21:35 -07:00
parent e72669354a
commit 1801c831ba

View File

@ -81,6 +81,7 @@ public class PlatformImpl extends AbstractPlatform {
getRawConfigRegistry().clear(); getRawConfigRegistry().clear();
boolean succeed = getRawConfigRegistry().loadAll(this); boolean succeed = getRawConfigRegistry().loadAll(this);
if(server != null) { if(server != null) {
server.reloadResources(server.getDataPackManager().getNames()).exceptionally(throwable -> { server.reloadResources(server.getDataPackManager().getNames()).exceptionally(throwable -> {
LOGGER.warn("Failed to execute reload", throwable); LOGGER.warn("Failed to execute reload", throwable);
@ -88,10 +89,12 @@ public class PlatformImpl extends AbstractPlatform {
}); });
} }
worlds.forEach(world -> { worlds.forEach(world -> {
FabricChunkGeneratorWrapper chunkGeneratorWrapper = ((FabricChunkGeneratorWrapper) world.getChunkManager().getChunkGenerator()); FabricChunkGeneratorWrapper chunkGeneratorWrapper = ((FabricChunkGeneratorWrapper) world.getChunkManager().getChunkGenerator());
chunkGeneratorWrapper.setPack(getConfigRegistry().get(chunkGeneratorWrapper.getPack().getRegistryKey()).orElseThrow()); getConfigRegistry().get(chunkGeneratorWrapper.getPack().getRegistryKey()).ifPresent(pack -> {
chunkGeneratorWrapper.setPack(pack);
LOGGER.info("Replaced pack in chunk generator for world {}", world);
});
}); });
return succeed; return succeed;