Skip to content

Commit 758377d

Browse files
committed
Fix Config Saving issue and Native Resolution Option crash
1 parent fae044d commit 758377d

File tree

2 files changed

+33
-24
lines changed

2 files changed

+33
-24
lines changed

common/src/main/java/com/minenash/seamless_loading_screen/OnLeaveHelper.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,17 @@ public static void beginScreenshotTask(Runnable runnable) {
5656
client.inGameHud.getDebugHud().renderingAndTickChartsVisible = false;
5757
client.inGameHud.getDebugHud().renderingChartVisible = false;
5858

59+
var resolution = SeamlessLoadingScreenConfig.get().resolution;
60+
61+
if(resolution == SeamlessLoadingScreenConfig.ScreenshotResolution.Native) return;
62+
5963
var window = MinecraftClient.getInstance().getWindow();
6064

6165
old_FrameBufferWidth = window.getFramebufferWidth();
6266
old_FrameBufferHeight = window.getFramebufferHeight();
6367

64-
window.setFramebufferWidth(SeamlessLoadingScreenConfig.get().resolution.width);
65-
window.setFramebufferHeight(SeamlessLoadingScreenConfig.get().resolution.height);
68+
window.setFramebufferWidth(resolution.width);
69+
window.setFramebufferHeight(resolution.height);
6670

6771
client.onResolutionChanged();
6872
}
@@ -113,12 +117,16 @@ public static void takeScreenShot() {
113117

114118
//--
115119

116-
var window = MinecraftClient.getInstance().getWindow();
120+
var resolution = SeamlessLoadingScreenConfig.get().resolution;
117121

118-
window.setFramebufferWidth(old_FrameBufferWidth);
119-
window.setFramebufferHeight(old_FrameBufferHeight);
122+
if(resolution != SeamlessLoadingScreenConfig.ScreenshotResolution.Native) {
123+
var window = MinecraftClient.getInstance().getWindow();
120124

121-
client.onResolutionChanged();
125+
window.setFramebufferWidth(old_FrameBufferWidth);
126+
window.setFramebufferHeight(old_FrameBufferHeight);
127+
128+
client.onResolutionChanged();
129+
}
122130

123131
//--
124132

common/src/main/java/com/minenash/seamless_loading_screen/config/SeamlessLoadingScreenConfig.java

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import dev.isxander.yacl3.api.controller.*;
77
import dev.isxander.yacl3.config.ConfigEntry;
88
import dev.isxander.yacl3.config.v2.api.ConfigClassHandler;
9+
import dev.isxander.yacl3.config.v2.api.SerialEntry;
910
import dev.isxander.yacl3.config.v2.api.serializer.GsonConfigSerializerBuilder;
1011
import net.minecraft.sound.SoundEvents;
1112
import net.minecraft.text.Style;
@@ -33,42 +34,42 @@ public class SeamlessLoadingScreenConfig {
3334
.build();
3435

3536
//=====================
36-
@ConfigEntry
37+
@SerialEntry
3738
public int fade = 20;
38-
@ConfigEntry
39+
@SerialEntry
3940
public int time = 80;
4041
//=====================
41-
@ConfigEntry
42+
@SerialEntry
4243
public Color tintColor = new Color(0x212121);
43-
@ConfigEntry
44+
@SerialEntry
4445
public float tintStrength = 0.3f;
45-
@ConfigEntry
46+
@SerialEntry
4647
public boolean enableScreenshotBlur = false;
47-
@ConfigEntry
48+
@SerialEntry
4849
public float screenshotBlurStrength = 1f; //min = 1f, max = 16f
49-
@ConfigEntry
50+
@SerialEntry
5051
public float screenshotBlurQuality = 5f; //min = 1f, max = 16f
51-
@ConfigEntry
52+
@SerialEntry
5253
public boolean playSoundEffect = false;
53-
@ConfigEntry
54+
@SerialEntry
5455
public String soundEffect = SoundEvents.UI_TOAST_OUT.getId().toString();
55-
@ConfigEntry
56+
@SerialEntry
5657
public float soundPitch = 1f; //min = 0f, max = 10f
57-
@ConfigEntry
58+
@SerialEntry
5859
public float soundVolume = 1f; //min = 0f, max = 10f
59-
@ConfigEntry
60+
@SerialEntry
6061
public ScreenshotResolution resolution = ScreenshotResolution.Normal;
61-
@ConfigEntry
62+
@SerialEntry
6263
public boolean disableCamera = true;
63-
@ConfigEntry
64+
@SerialEntry
6465
public boolean archiveScreenshots = false;
65-
@ConfigEntry
66+
@SerialEntry
6667
public boolean updateWorldIcon = false;
67-
@ConfigEntry
68+
@SerialEntry
6869
public List<String> blacklistedAddresses = List.of("play.wynncraft.com");
69-
@ConfigEntry
70+
@SerialEntry
7071
public boolean saveScreenshotsByUsername = false;
71-
@ConfigEntry
72+
@SerialEntry
7273
public DisplayMode defaultServerMode = DisplayMode.DISABLED;
7374
//=====================
7475

0 commit comments

Comments
 (0)