use of me.jellysquid.mods.sodium.client.gui.options.storage.OptionStorage in project sodium-fabric by CaffeineMC.
the class SodiumOptionsGUI method applyChanges.
private void applyChanges() {
final HashSet<OptionStorage<?>> dirtyStorages = new HashSet<>();
final EnumSet<OptionFlag> flags = EnumSet.noneOf(OptionFlag.class);
for (Option<?> option : this.currentPage.getOptions()) {
if (!option.hasChanged()) {
continue;
}
option.applyChanges();
flags.addAll(option.getFlags());
dirtyStorages.add(option.getStorage());
}
MinecraftClient client = MinecraftClient.getInstance();
if (flags.contains(OptionFlag.REQUIRES_RENDERER_RELOAD)) {
client.worldRenderer.reload();
}
if (flags.contains(OptionFlag.REQUIRES_ASSET_RELOAD)) {
client.resetMipmapLevels(client.options.mipmapLevels);
client.reloadResourcesConcurrently();
}
for (OptionStorage<?> storage : dirtyStorages) {
storage.save();
}
}
use of me.jellysquid.mods.sodium.client.gui.options.storage.OptionStorage in project reeses-sodium-options by FlashyReese.
the class SodiumVideoOptionsScreen method applyChanges.
private void applyChanges() {
final HashSet<OptionStorage<?>> dirtyStorages = new HashSet<>();
final EnumSet<OptionFlag> flags = EnumSet.noneOf(OptionFlag.class);
this.getAllOptions().forEach((option -> {
if (!option.hasChanged()) {
return;
}
option.applyChanges();
flags.addAll(option.getFlags());
dirtyStorages.add(option.getStorage());
}));
MinecraftClient client = MinecraftClient.getInstance();
if (flags.contains(OptionFlag.REQUIRES_RENDERER_RELOAD)) {
client.worldRenderer.reload();
}
if (flags.contains(OptionFlag.REQUIRES_ASSET_RELOAD)) {
client.setMipmapLevels(client.options.mipmapLevels);
client.reloadResourcesConcurrently();
}
for (OptionStorage<?> storage : dirtyStorages) {
storage.save();
}
}
Aggregations