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) { public static CompoundNBT applyDefaults(CompoundNBT options, TerraSettings dest) {
if (options.isEmpty()) { if (options.isEmpty()) {
try (Reader reader = new BufferedReader(new FileReader(DEFAULTS_FILE))) { TerraSettings defaults = readDefaults();
JsonElement json = new JsonParser().parse(reader); options = NBTHelper.serialize(defaults);
options = NBTHelper.fromJson(json);
} catch (IOException ignored) {
}
} }
NBTHelper.deserialize(options, dest); NBTHelper.deserialize(options, dest);
return options; 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.SimplePreviewPage;
import com.terraforged.mod.client.gui.page.WorldPage; import com.terraforged.mod.client.gui.page.WorldPage;
import com.terraforged.mod.client.gui.preview.PreviewPage; import com.terraforged.mod.client.gui.preview.PreviewPage;
import com.terraforged.mod.util.nbt.NBTHelper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.IGuiEventListener; import net.minecraft.client.gui.IGuiEventListener;
import net.minecraft.client.gui.screen.CreateWorldScreen; import net.minecraft.client.gui.screen.CreateWorldScreen;
@ -111,7 +112,7 @@ public class SettingsScreen extends OverlayScreen {
for (Page page : pages) { for (Page page : pages) {
page.save(); page.save();
} }
// parent.chunkProviderSettingsJson = NBTHelper.serializeCompact(settings); parent.chunkProviderSettingsJson = NBTHelper.serializeCompact(instance.settings);
SettingsScreen.setSeed(parent, preview.getSeed()); SettingsScreen.setSeed(parent, preview.getSeed());
onClose(); onClose();
})); }));