Configs saved before 0.1.3 hold the old default and preset background and primary colors fully opaque, so glass didn't show for anyone updating. On a config without Menu blur (new in 0.1.3), colors that are an old default or preset get their translucent alpha; colors players picked stay as they are. Co-Authored-By: Claude Opus 5.5 <[email protected]>
76 lines
3.9 KiB
Java
76 lines
3.9 KiB
Java
package org.saturnclient.config;
|
||
|
||
import java.io.File;
|
||
|
||
import org.saturnclient.common.provider.GLFWProvider;
|
||
import org.saturnclient.common.provider.Providers;
|
||
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||
import org.saturnclient.config.property.BoolProperty;
|
||
import org.saturnclient.config.property.FloatProperty;
|
||
import org.saturnclient.config.property.IntProperty;
|
||
import org.saturnclient.config.property.KeybindingProperty;
|
||
import org.saturnclient.config.property.Property;
|
||
import org.saturnclient.ui.resources.Textures;
|
||
|
||
public class Config {
|
||
public static ConfigManager config;
|
||
|
||
public static BoolProperty realisticLogo = Property.bool(false);
|
||
public static BoolProperty saturnTitleScreen = Property.bool(true);
|
||
public static BoolProperty cloakPhysics = Property.bool(true);
|
||
public static BoolProperty stagger = Property.bool(true);
|
||
/** The world or panorama behind Saturn's screens, faded in as they open */
|
||
public static IntProperty backgroundBlur = Property.integer(5).range(0, 10);
|
||
/** Glass behind translucent menus (panels), and widgets (buttons, the dock) */
|
||
public static IntProperty menuBlur = Property.integer(8).range(0, 20);
|
||
public static IntProperty widgetBlur = Property.integer(6).range(0, 20);
|
||
// How big Saturn's screens are, relative to Minecraft's GUI scale
|
||
public static FloatProperty titleScale = guiScale();
|
||
public static FloatProperty menuScale = guiScale();
|
||
public static FloatProperty hudMenuScale = guiScale();
|
||
|
||
/** Added in 0.1.3, so a config without it was saved by an older version */
|
||
static final String MENU_BLUR = "Menu blur";
|
||
public static KeybindingProperty openEmoteWheel = Property.keybinding(GLFWProvider.GLFW_KEY_B);
|
||
|
||
private static FloatProperty guiScale() {
|
||
return Property.floatProp(1f).range(0.5f, 2f, 0.05f).unit("×");
|
||
}
|
||
|
||
/**
|
||
* Whether any glass can be drawn: a glass blur is on, and a background it
|
||
* goes behind isn't solid.
|
||
*/
|
||
public static boolean usesGlass() {
|
||
boolean translucent = Theme.getPanelBg() >>> 24 < 0xFF || Theme.PRIMARY.value >>> 24 < 0xFF;
|
||
return translucent && (menuBlur.value > 0 || widgetBlur.value > 0);
|
||
}
|
||
|
||
public static IdentifierRef getLogo() {
|
||
return realisticLogo.value ? Textures.REALISTIC_LOGO : Textures.LOGO;
|
||
}
|
||
|
||
public static void init() {
|
||
File configFile = new File(Providers.saturn.getClient().getRunDirectory(), "saturn.json");
|
||
config = new ConfigManager(configFile, "Saturn Client");
|
||
|
||
config.property("Realistic logo", realisticLogo, "Use the realistic Saturn logo");
|
||
config.property("Saturn client title screen", saturnTitleScreen, "Replace the title screen with Saturn's");
|
||
config.property("Open Emote Wheel", openEmoteWheel, "The key that opens the emote wheel");
|
||
config.property("Cloak Physics", cloakPhysics, "Let cloaks swing as you move");
|
||
config.property("Stagger Animations", stagger, "Animate list items one after another");
|
||
config.property("World blur", backgroundBlur, "How much the world or panorama behind Saturn's screens is blurred");
|
||
config.property(MENU_BLUR, menuBlur, "How much the game is blurred through translucent menus");
|
||
config.property("Widget blur", widgetBlur, "How much the game is blurred through translucent buttons and the dock");
|
||
config.property("Title screen scale", titleScale, "How big the title screen is, relative to Minecraft's GUI scale");
|
||
config.property("Menu scale", menuScale, "How big the mods, settings and cosmetics menus are, relative to Minecraft's GUI scale");
|
||
config.property("HUD menu scale", hudMenuScale, "How big the emote wheel and shift menu are, relative to Minecraft's GUI scale");
|
||
|
||
// Initialize a sub namespace for theme
|
||
Theme.init(config);
|
||
|
||
// Initialize a sub namespace for animations
|
||
AnimationConfig.init(config);
|
||
}
|
||
}
|