actually save the generator settings to the worldinfo

This commit is contained in:
dags- 2020-06-27 09:49:53 +01:00
parent 4190d40a2b
commit 54b7ad7e85
2 changed files with 4 additions and 7 deletions

View File

@ -43,12 +43,8 @@ public class SettingsHelper {
public static CompoundNBT applyDefaults(CompoundNBT options, TerraSettings dest) {
if (options.isEmpty()) {
try (Reader reader = new BufferedReader(new FileReader(DEFAULTS_FILE))) {
JsonElement json = new JsonParser().parse(reader);
options = NBTHelper.fromJson(json);
} catch (IOException ignored) {
}
TerraSettings defaults = readDefaults();
options = NBTHelper.serialize(defaults);
}
NBTHelper.deserialize(options, dest);
return options;

View File

@ -34,6 +34,7 @@ import com.terraforged.mod.client.gui.page.SimplePage;
import com.terraforged.mod.client.gui.page.SimplePreviewPage;
import com.terraforged.mod.client.gui.page.WorldPage;
import com.terraforged.mod.client.gui.preview.PreviewPage;
import com.terraforged.mod.util.nbt.NBTHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.IGuiEventListener;
import net.minecraft.client.gui.screen.CreateWorldScreen;
@ -111,7 +112,7 @@ public class SettingsScreen extends OverlayScreen {
for (Page page : pages) {
page.save();
}
// parent.chunkProviderSettingsJson = NBTHelper.serializeCompact(settings);
parent.chunkProviderSettingsJson = NBTHelper.serializeCompact(instance.settings);
SettingsScreen.setSeed(parent, preview.getSeed());
onClose();
}));