forked from virt-mirrors/Sit
fix modmenu data entry not removing bad data
This commit is contained in:
parent
817a6333cf
commit
5fff3687c7
1 changed files with 8 additions and 1 deletions
|
@ -13,17 +13,24 @@ import net.minecraft.util.Formatting;
|
|||
import one.oth3r.sit.file.Config;
|
||||
|
||||
public class ModMenu implements ModMenuApi {
|
||||
|
||||
private static MutableText lang(String key) {
|
||||
return Text.translatable("config.sit."+key);
|
||||
}
|
||||
|
||||
private static MutableText lang(String key, Object... args) {
|
||||
return Text.translatable("config.sit."+key,args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||
// return null if YACL isn't installed to not throw an error
|
||||
if (!yaclCheck()) return screen -> null;
|
||||
return parent -> YetAnotherConfigLib.createBuilder().save(Config::save)
|
||||
return parent -> YetAnotherConfigLib.createBuilder().save(() -> {
|
||||
// save and load to get rid of bad data
|
||||
Config.save();
|
||||
Config.load();
|
||||
})
|
||||
.title(Text.of("Sit!"))
|
||||
.category(ConfigCategory.createBuilder()
|
||||
.name(lang("category.general"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue