diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/gui/SodiumGameOptionPages.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/gui/SodiumGameOptionPages.java index 9ff3265ce2..b97e3fa433 100644 --- a/common/src/main/java/net/caffeinemc/mods/sodium/client/gui/SodiumGameOptionPages.java +++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/gui/SodiumGameOptionPages.java @@ -5,6 +5,7 @@ import com.mojang.blaze3d.platform.Monitor; import com.mojang.blaze3d.platform.VideoMode; import com.mojang.blaze3d.platform.Window; +import net.caffeinemc.mods.sodium.client.compatibility.environment.OsUtils; import net.caffeinemc.mods.sodium.client.gl.arena.staging.MappedStagingBuffer; import net.caffeinemc.mods.sodium.client.gl.device.RenderDevice; import net.caffeinemc.mods.sodium.client.gui.options.*; @@ -94,7 +95,7 @@ public static OptionPage general() { .build()) .add(OptionImpl.createBuilder(int.class, vanillaOpts) .setName(Component.translatable("options.fullscreen.resolution")) - .setTooltip(Component.translatable("options.fullscreen.resolution")) + .setTooltip(Component.translatable("sodium.options.fullscreen_resolution.tooltip")) .setControl(option -> new SliderControl(option, 0, null != monitor? monitor.getModeCount(): 0, 1, ControlValueFormatter.resolution())) .setBinding((options, value) -> { if (null != monitor) { @@ -109,7 +110,7 @@ public static OptionPage general() { return optional.map((videoMode) -> monitor.getVideoModeIndex(videoMode) + 1).orElse(0); } }) - .setImpact(OptionImpact.HIGH) + .setEnabled(() -> OsUtils.getOs() == OsUtils.OperatingSystem.WIN && Minecraft.getInstance().getWindow().findBestMonitor() != null) .setFlags(OptionFlag.REQUIRES_VIDEOMODE_RELOAD) .build()) .add(OptionImpl.createBuilder(boolean.class, vanillaOpts) diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/gui/options/control/ControlValueFormatter.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/gui/options/control/ControlValueFormatter.java index ee9a02d296..c7d8e30507 100644 --- a/common/src/main/java/net/caffeinemc/mods/sodium/client/gui/options/control/ControlValueFormatter.java +++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/gui/options/control/ControlValueFormatter.java @@ -1,6 +1,7 @@ package net.caffeinemc.mods.sodium.client.gui.options.control; import com.mojang.blaze3d.platform.Monitor; +import net.caffeinemc.mods.sodium.client.compatibility.environment.OsUtils; import net.minecraft.client.Minecraft; import net.minecraft.network.chat.Component; @@ -10,9 +11,10 @@ static ControlValueFormatter guiScale() { } static ControlValueFormatter resolution() { - Monitor monitor = Minecraft.getInstance().getWindow().findBestMonitor(); return (v) -> { - if (null == monitor) { + Monitor monitor = Minecraft.getInstance().getWindow().findBestMonitor(); + + if (OsUtils.getOs() != OsUtils.OperatingSystem.WIN || monitor == null) { return Component.translatable("options.fullscreen.unavailable"); } else if (0 == v) { return Component.translatable("options.fullscreen.current"); diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/gui/options/control/SliderControl.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/gui/options/control/SliderControl.java index 11097c6cc6..99c379b493 100644 --- a/common/src/main/java/net/caffeinemc/mods/sodium/client/gui/options/control/SliderControl.java +++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/gui/options/control/SliderControl.java @@ -3,9 +3,10 @@ import com.mojang.blaze3d.platform.InputConstants; import net.caffeinemc.mods.sodium.client.gui.options.Option; import net.caffeinemc.mods.sodium.client.util.Dim2i; +import net.minecraft.ChatFormatting; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.Rect2i; -import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.Style; import net.minecraft.util.Mth; import org.apache.commons.lang3.Validate; @@ -81,7 +82,15 @@ public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { int sliderWidth = this.sliderBounds.getWidth(); int sliderHeight = this.sliderBounds.getHeight(); - Component label = this.formatter.format(this.option.getValue()); + var label = this.formatter.format(this.option.getValue()) + .copy(); + + if (!this.option.isAvailable()) { + label.setStyle(Style.EMPTY + .withColor(ChatFormatting.GRAY) + .withItalic(true)); + } + int labelWidth = this.font.width(label); boolean drawSlider = this.option.isAvailable() && (this.hovered || this.isFocused()); diff --git a/common/src/main/resources/assets/sodium/lang/en_us.json b/common/src/main/resources/assets/sodium/lang/en_us.json index b128222a27..d1d1e6b6a7 100644 --- a/common/src/main/resources/assets/sodium/lang/en_us.json +++ b/common/src/main/resources/assets/sodium/lang/en_us.json @@ -12,6 +12,7 @@ "sodium.options.brightness.tooltip": "Controls the minimum brightness in the world. When increased, darker areas of the world will appear brighter. This does not affect the brightness of already well-lit areas.", "sodium.options.gui_scale.tooltip": "Sets the maximum scale factor to be used for the user interface. If \"auto\" is used, then the largest scale factor will always be used.", "sodium.options.fullscreen.tooltip": "If enabled, the game will display in full-screen (if supported).", + "sodium.options.fullscreen_resolution.tooltip": "The monitor resolution and refresh rate to be used when in fullscreen mode. Changing this option may interfere with other applications and cause a delay when switching between applications.\n\nThis is only supported on the Windows operating system.", "sodium.options.v_sync.tooltip": "If enabled, the game's frame rate will be synchronized to the monitor's refresh rate, making for a generally smoother experience at the expense of overall input latency. This setting might reduce performance if your system is too slow.", "sodium.options.fps_limit.tooltip": "Limits the maximum number of frames per second. This can help reduce battery usage and system load when multi-tasking. If VSync is enabled, this option will be ignored unless it is lower than your display's refresh rate.", "sodium.options.view_bobbing.tooltip": "If enabled, the player's view will sway and bob when moving around. Players who experience motion sickness while playing may benefit from disabling this.",