Skip to content

Commit

Permalink
Fix Config Saving issue and Native Resolution Option crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragon-Seeker committed Nov 6, 2023
1 parent fae044d commit 758377d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,17 @@ public static void beginScreenshotTask(Runnable runnable) {
client.inGameHud.getDebugHud().renderingAndTickChartsVisible = false;
client.inGameHud.getDebugHud().renderingChartVisible = false;

var resolution = SeamlessLoadingScreenConfig.get().resolution;

if(resolution == SeamlessLoadingScreenConfig.ScreenshotResolution.Native) return;

var window = MinecraftClient.getInstance().getWindow();

old_FrameBufferWidth = window.getFramebufferWidth();
old_FrameBufferHeight = window.getFramebufferHeight();

window.setFramebufferWidth(SeamlessLoadingScreenConfig.get().resolution.width);
window.setFramebufferHeight(SeamlessLoadingScreenConfig.get().resolution.height);
window.setFramebufferWidth(resolution.width);
window.setFramebufferHeight(resolution.height);

client.onResolutionChanged();
}
Expand Down Expand Up @@ -113,12 +117,16 @@ public static void takeScreenShot() {

//--

var window = MinecraftClient.getInstance().getWindow();
var resolution = SeamlessLoadingScreenConfig.get().resolution;

window.setFramebufferWidth(old_FrameBufferWidth);
window.setFramebufferHeight(old_FrameBufferHeight);
if(resolution != SeamlessLoadingScreenConfig.ScreenshotResolution.Native) {
var window = MinecraftClient.getInstance().getWindow();

client.onResolutionChanged();
window.setFramebufferWidth(old_FrameBufferWidth);
window.setFramebufferHeight(old_FrameBufferHeight);

client.onResolutionChanged();
}

//--

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import dev.isxander.yacl3.api.controller.*;
import dev.isxander.yacl3.config.ConfigEntry;
import dev.isxander.yacl3.config.v2.api.ConfigClassHandler;
import dev.isxander.yacl3.config.v2.api.SerialEntry;
import dev.isxander.yacl3.config.v2.api.serializer.GsonConfigSerializerBuilder;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Style;
Expand Down Expand Up @@ -33,42 +34,42 @@ public class SeamlessLoadingScreenConfig {
.build();

//=====================
@ConfigEntry
@SerialEntry
public int fade = 20;
@ConfigEntry
@SerialEntry
public int time = 80;
//=====================
@ConfigEntry
@SerialEntry
public Color tintColor = new Color(0x212121);
@ConfigEntry
@SerialEntry
public float tintStrength = 0.3f;
@ConfigEntry
@SerialEntry
public boolean enableScreenshotBlur = false;
@ConfigEntry
@SerialEntry
public float screenshotBlurStrength = 1f; //min = 1f, max = 16f
@ConfigEntry
@SerialEntry
public float screenshotBlurQuality = 5f; //min = 1f, max = 16f
@ConfigEntry
@SerialEntry
public boolean playSoundEffect = false;
@ConfigEntry
@SerialEntry
public String soundEffect = SoundEvents.UI_TOAST_OUT.getId().toString();
@ConfigEntry
@SerialEntry
public float soundPitch = 1f; //min = 0f, max = 10f
@ConfigEntry
@SerialEntry
public float soundVolume = 1f; //min = 0f, max = 10f
@ConfigEntry
@SerialEntry
public ScreenshotResolution resolution = ScreenshotResolution.Normal;
@ConfigEntry
@SerialEntry
public boolean disableCamera = true;
@ConfigEntry
@SerialEntry
public boolean archiveScreenshots = false;
@ConfigEntry
@SerialEntry
public boolean updateWorldIcon = false;
@ConfigEntry
@SerialEntry
public List<String> blacklistedAddresses = List.of("play.wynncraft.com");
@ConfigEntry
@SerialEntry
public boolean saveScreenshotsByUsername = false;
@ConfigEntry
@SerialEntry
public DisplayMode defaultServerMode = DisplayMode.DISABLED;
//=====================

Expand Down

0 comments on commit 758377d

Please sign in to comment.