Compare commits
No commits in common. "068af590456f49ee2d6732b73d84fa24176f8927" and "7daed8f7d1ff135092d3314174b275c898c8b8f5" have entirely different histories.
068af59045
...
7daed8f7d1
@ -0,0 +1,10 @@
|
||||
package net.deechael.concentration.mixin;
|
||||
|
||||
import net.minecraft.client.main.Main;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@Mixin(Main.class)
|
||||
public class MainMixin {
|
||||
|
||||
|
||||
}
|
@ -89,11 +89,7 @@ public abstract class VideoSettingsScreenMixin extends OptionsSubScreen {
|
||||
@Unique
|
||||
private static OptionInstance<Boolean> concentration$wrapperFullscreen(Options options) {
|
||||
// Don't put a constant to the second parameter, or else whatever fullscreen you are, when you open video settings page, the value shown is always the same
|
||||
return OptionInstance.createBoolean(
|
||||
"options.fullscreen",
|
||||
options.fullscreen().get(),
|
||||
(value) -> Concentration.toggleFullScreenMode(options, value)
|
||||
);
|
||||
return OptionInstance.createBoolean("options.fullscreen", options.fullscreen().get(), (value) -> Concentration.toggleFullScreenMode(options, value));
|
||||
}
|
||||
|
||||
@Shadow
|
||||
|
@ -7,6 +7,7 @@
|
||||
"mixins": [],
|
||||
"client": [
|
||||
"KeyboardHandlerMixin",
|
||||
"MainMixin",
|
||||
"VideoSettingsScreenMixin",
|
||||
"accessor.WindowAccessor"
|
||||
],
|
||||
|
@ -19,8 +19,8 @@ dependencies {
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
|
||||
|
||||
modImplementation "maven.modrinth:modmenu:11.0.0"
|
||||
modImplementation "maven.modrinth:sodium:mc1.21-0.5.11"
|
||||
modImplementation "maven.modrinth:sodium:mc1.21-0.6.0-beta.2-fabric"
|
||||
modImplementation "maven.modrinth:sodium-extra:mc1.21.1-0.6.0-beta.3+fabric"
|
||||
modImplementation "maven.modrinth:vulkanmod:0.4.9-fabric,1.21"
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ public class ConcentrationFabricCaching {
|
||||
|
||||
public static boolean cachedSize = false;
|
||||
public static boolean cachedPos = false;
|
||||
public static boolean cacheSizeLock = true;
|
||||
public static boolean cacheSizeLock = false;
|
||||
|
||||
public static int cachedX = 0;
|
||||
public static int cachedY = 0;
|
||||
|
@ -1,21 +0,0 @@
|
||||
package net.deechael.concentration.fabric.compat;
|
||||
|
||||
import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
|
||||
public class SodiumExtraCompat {
|
||||
|
||||
public static boolean checkMacReduceResolution() {
|
||||
if (!FabricLoader.getInstance().isModLoaded("sodium-extra"))
|
||||
return false;
|
||||
String os = System.getProperty("os.name").toLowerCase();
|
||||
if (!(os.contains("mac") || os.contains("darwin")))
|
||||
return false;
|
||||
return checkMacReduceResolution0();
|
||||
}
|
||||
|
||||
private static boolean checkMacReduceResolution0() {
|
||||
return SodiumExtraClientMod.options().extraSettings.reduceResolutionOnMac;
|
||||
}
|
||||
|
||||
}
|
@ -28,13 +28,12 @@ public class GLFWMixin {
|
||||
|
||||
@Inject(method = "glfwSetWindowMonitor", at = @At("HEAD"), cancellable = true)
|
||||
private static void inject$glfwSetWindowMonitor(long window, long monitor, int xpos, int ypos, int width, int height, int refreshRate, CallbackInfo ci) {
|
||||
Window windowInstance = Minecraft.getInstance().getWindow();
|
||||
if (windowInstance == null)
|
||||
return;
|
||||
|
||||
ConcentrationConstants.LOGGER.info("================= [Concentration Start] =================");
|
||||
ConcentrationConstants.LOGGER.info("Trying to modify window monitor");
|
||||
|
||||
Window windowInstance = Minecraft.getInstance().getWindow();
|
||||
if (windowInstance == null)
|
||||
return;
|
||||
WindowAccessor accessor = (WindowAccessor) (Object) windowInstance;
|
||||
|
||||
if (windowInstance.isFullscreen())
|
||||
@ -95,7 +94,7 @@ public class GLFWMixin {
|
||||
finalHeight = config.height + (config.height == height ? 1 : 0);
|
||||
} else {
|
||||
finalX = monitorInstance.getX();
|
||||
finalY = monitorInstance.getY();
|
||||
finalY = monitorInstance.getY() - 1;
|
||||
finalWidth = width;
|
||||
finalHeight = height + 1;
|
||||
}
|
||||
@ -133,10 +132,6 @@ public class GLFWMixin {
|
||||
ConcentrationConstants.LOGGER.info("Unlocked size caching");
|
||||
}
|
||||
|
||||
if (monitor != 0L) {
|
||||
ConcentrationFabricCaching.lastMonitor = monitor;
|
||||
}
|
||||
|
||||
ConcentrationConstants.LOGGER.info("Window size: {}, {}, position: {}, {}", finalWidth, finalHeight, finalX, finalY);
|
||||
|
||||
ConcentrationConstants.LOGGER.info("Trying to resize and reposition the window");
|
||||
|
@ -27,23 +27,24 @@ public class OptionsMixin {
|
||||
Option<?>[] newOptions = new Option<?>[6];
|
||||
newOptions[0] = options[0];
|
||||
newOptions[1] = options[1];
|
||||
newOptions[2] = options[2];
|
||||
newOptions[3] = new CyclingOption<>(
|
||||
newOptions[2] = new CyclingOption<>(
|
||||
Component.translatable("concentration.option.fullscreen_mode"),
|
||||
FullscreenMode.values(),
|
||||
value -> {
|
||||
ConcentrationConfigFabric.getInstance().fullscreen = value;
|
||||
ConcentrationConfigFabric.getInstance().save();
|
||||
if (minecraftOptions.fullscreen().get()) {
|
||||
// If fullscreen turns on, re-toggle to changing the fullscreen mode instantly
|
||||
Concentration.toggleFullScreenMode(minecraftOptions, true);
|
||||
}
|
||||
},
|
||||
() -> ConcentrationConfigFabric.getInstance().fullscreen
|
||||
).setTranslator(fullscreenMode -> Component.translatable(fullscreenMode.getKey()));
|
||||
newOptions[3] = options[3];
|
||||
newOptions[4] = options[4];
|
||||
newOptions[5] = options[5];
|
||||
|
||||
Option<Boolean> fullscreenOption = (Option<Boolean>) newOptions[2];
|
||||
Option<Boolean> fullscreenOption = (Option<Boolean>) newOptions[3];
|
||||
fullscreenOption.setOnApply(value -> {
|
||||
Concentration.toggleFullScreenMode(minecraftOptions, value);
|
||||
});
|
||||
|
@ -1,12 +1,13 @@
|
||||
package net.deechael.concentration.fabric.mixin;
|
||||
|
||||
import com.mojang.blaze3d.platform.*;
|
||||
import com.mojang.blaze3d.platform.Monitor;
|
||||
import com.mojang.blaze3d.platform.ScreenManager;
|
||||
import com.mojang.blaze3d.platform.VideoMode;
|
||||
import com.mojang.blaze3d.platform.Window;
|
||||
import net.deechael.concentration.ConcentrationConstants;
|
||||
import net.deechael.concentration.FullscreenMode;
|
||||
import net.deechael.concentration.config.Config;
|
||||
import net.deechael.concentration.config.ConfigProvider;
|
||||
import net.deechael.concentration.fabric.ConcentrationFabricCaching;
|
||||
import net.deechael.concentration.fabric.compat.SodiumExtraCompat;
|
||||
import net.deechael.concentration.fabric.config.ConcentrationConfigFabric;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.glfw.GLFWNativeWin32;
|
||||
@ -47,20 +48,12 @@ public abstract class WindowMixin {
|
||||
@Final
|
||||
private long window;
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
private void inject$init(WindowEventHandler eventHandler, ScreenManager screenManager, DisplayData displayData, String preferredFullscreenVideoMode, String title, CallbackInfo ci) {
|
||||
ConcentrationConstants.LOGGER.info(" =============================================");
|
||||
String osName = System.getProperty("os.name").toLowerCase();
|
||||
if (osName.contains("windows")) {
|
||||
ConcentrationConstants.LOGGER.info(" == System: Windows ==");
|
||||
} else if (osName.contains("darwin") || osName.contains("mac")) {
|
||||
ConcentrationConstants.LOGGER.info(" == System: macOS ==");
|
||||
} else {
|
||||
ConcentrationConstants.LOGGER.info(" == System: Linux ==");
|
||||
}
|
||||
// ConcentrationConstants.LOGGER.info(" == ==");
|
||||
ConcentrationConstants.LOGGER.info(" =============================================");
|
||||
}
|
||||
@Shadow
|
||||
public abstract boolean isFullscreen();
|
||||
|
||||
@Shadow public abstract int getScreenWidth();
|
||||
|
||||
@Shadow public abstract int getScreenHeight();
|
||||
|
||||
@Inject(method = "onMove", at = @At("HEAD"))
|
||||
private void inject$onMove$head(long window, int x, int y, CallbackInfo ci) {
|
||||
@ -93,7 +86,6 @@ public abstract class WindowMixin {
|
||||
|
||||
Monitor monitorInstance = this.screenManager.getMonitor(monitor);
|
||||
ConcentrationConstants.LOGGER.info("Current fullscreen monitor is {}", monitor);
|
||||
ConcentrationConstants.LOGGER.info("Current fullscreen mode is {}", ConfigProvider.INSTANCE.ensureLoaded().getFullscreenMode());
|
||||
|
||||
if (monitor != 0L) {
|
||||
VideoMode currentMode = monitorInstance.getCurrentMode();
|
||||
@ -145,20 +137,17 @@ public abstract class WindowMixin {
|
||||
finalHeight = config.height + (config.height == height ? 1 : 0);
|
||||
} else {
|
||||
finalX = monitorInstance.getX();
|
||||
finalY = monitorInstance.getY();
|
||||
finalY = monitorInstance.getY() - 1;
|
||||
finalWidth = ignored$width;
|
||||
finalHeight = ignored$height + 1;
|
||||
}
|
||||
if (SodiumExtraCompat.checkMacReduceResolution()) {
|
||||
ConcentrationConstants.LOGGER.info("On macOS and reduce resolution in Sodium Extra enabled, reduce the resolution");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.x = finalX;
|
||||
this.y = finalY;
|
||||
this.width = finalWidth;
|
||||
this.height = finalHeight;
|
||||
}
|
||||
} else {
|
||||
ConcentrationConstants.LOGGER.info("Trying to switch to windowed mode");
|
||||
finalMonitor = 0L;
|
||||
@ -184,10 +173,6 @@ public abstract class WindowMixin {
|
||||
ConcentrationConstants.LOGGER.info("Unlocked size caching");
|
||||
}
|
||||
|
||||
if (monitor != 0L) {
|
||||
ConcentrationFabricCaching.lastMonitor = monitor;
|
||||
}
|
||||
|
||||
ConcentrationConstants.LOGGER.info("Window size: {}, {}, position: {}, {}", finalWidth, finalHeight, finalX, finalY);
|
||||
|
||||
ConcentrationConstants.LOGGER.info("Trying to resize and reposition the window");
|
||||
@ -217,7 +202,7 @@ public abstract class WindowMixin {
|
||||
}
|
||||
} else {
|
||||
GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE);
|
||||
GLFW.glfwSetWindowAttrib(this.window, 0x20006, 1);
|
||||
GLFW.glfwSetWindowAttrib(this.window, 0x20006, 0);
|
||||
if (System.getProperty("os.name").contains("Windows")) {
|
||||
long hWnd = GLFWNativeWin32.glfwGetWin32Window(this.window);
|
||||
if (hWnd != 0) {
|
||||
|
@ -48,6 +48,9 @@ public abstract class WindowMixin {
|
||||
@Final
|
||||
private long window;
|
||||
|
||||
@Shadow
|
||||
public abstract boolean isFullscreen();
|
||||
|
||||
@Unique
|
||||
private long concentration$lastMonitor = -1;
|
||||
|
||||
@ -56,7 +59,7 @@ public abstract class WindowMixin {
|
||||
@Unique
|
||||
private boolean concentration$cachedPos = false;
|
||||
@Unique
|
||||
private boolean concentration$cacheSizeLock = true;
|
||||
private boolean concentration$cacheSizeLock = false;
|
||||
|
||||
@Unique
|
||||
private int concentration$cachedX = 0;
|
||||
@ -154,7 +157,7 @@ public abstract class WindowMixin {
|
||||
finalHeight = configHeight + (configHeight == height ? 1 : 0);
|
||||
} else {
|
||||
finalX = monitorInstance.getX();
|
||||
finalY = monitorInstance.getY();
|
||||
finalY = monitorInstance.getY() - 1;
|
||||
finalWidth = width;
|
||||
finalHeight = height + 1;
|
||||
}
|
||||
@ -190,10 +193,6 @@ public abstract class WindowMixin {
|
||||
ConcentrationConstants.LOGGER.info("Unlocked size caching");
|
||||
}
|
||||
|
||||
if (monitor != 0L) {
|
||||
this.concentration$lastMonitor = monitor;
|
||||
}
|
||||
|
||||
ConcentrationConstants.LOGGER.info("Window size: {}, {}, position: {}, {}", finalWidth, finalHeight, finalX, finalY);
|
||||
|
||||
ConcentrationConstants.LOGGER.info("Trying to resize and reposition the window");
|
||||
|
@ -1,4 +1,4 @@
|
||||
version=2.2.4
|
||||
version=2.2.2
|
||||
group=net.deechael.concentration
|
||||
java_version=21
|
||||
|
||||
|
@ -48,6 +48,9 @@ public abstract class WindowMixin {
|
||||
@Final
|
||||
private long window;
|
||||
|
||||
@Shadow
|
||||
public abstract boolean isFullscreen();
|
||||
|
||||
@Unique
|
||||
private long concentration$lastMonitor = -1;
|
||||
|
||||
@ -56,7 +59,7 @@ public abstract class WindowMixin {
|
||||
@Unique
|
||||
private boolean concentration$cachedPos = false;
|
||||
@Unique
|
||||
private boolean concentration$cacheSizeLock = true;
|
||||
private boolean concentration$cacheSizeLock = false;
|
||||
|
||||
@Unique
|
||||
private int concentration$cachedX = 0;
|
||||
@ -154,16 +157,12 @@ public abstract class WindowMixin {
|
||||
finalHeight = configHeight + (configHeight == height ? 1 : 0);
|
||||
} else {
|
||||
finalX = monitorInstance.getX();
|
||||
finalY = monitorInstance.getY();
|
||||
finalY = monitorInstance.getY() - 1;
|
||||
finalWidth = width;
|
||||
finalHeight = height + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (monitor != 0L) {
|
||||
this.concentration$lastMonitor = monitor;
|
||||
}
|
||||
|
||||
this.x = finalX;
|
||||
this.y = finalY;
|
||||
this.width = finalWidth;
|
||||
|
Loading…
Reference in New Issue
Block a user