diff --git a/build.gradle.kts b/build.gradle.kts index aabbcbe..f063fd8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,11 +1,11 @@ plugins { id("java") - id("org.jetbrains.kotlin.jvm") version "1.9.0" + id("org.jetbrains.kotlin.jvm") version "2.0.0" id("org.jetbrains.intellij") version "1.16.0" } group = "rs485.network" -version = "1.0-SNAPSHOT" +version = "1.1-SNAPSHOT" repositories { mavenCentral() @@ -14,25 +14,29 @@ repositories { // Configure Gradle IntelliJ Plugin // Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html intellij { - version.set("2023.3.3") + version.set("2024.1.3") type.set("IC") // Target IDE Platform plugins.set(listOf("com.intellij.java")) } +kotlin { + compilerOptions { + jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17) + apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0) + } +} + tasks { // Set the JVM compatibility versions withType { sourceCompatibility = "17" targetCompatibility = "17" } - withType { - kotlinOptions.jvmTarget = "17" - } patchPluginXml { sinceBuild.set("233") - untilBuild.set("233.*") + //untilBuild.set("241.*") } signPlugin { diff --git a/src/main/kotlin/rs485/network/breakpoint/LWJGLExitMouseGrabDebuggerManagerListener.kt b/src/main/kotlin/rs485/network/breakpoint/LWJGLExitMouseGrabDebuggerManagerListener.kt index fbe3c1b..c5a39f2 100644 --- a/src/main/kotlin/rs485/network/breakpoint/LWJGLExitMouseGrabDebuggerManagerListener.kt +++ b/src/main/kotlin/rs485/network/breakpoint/LWJGLExitMouseGrabDebuggerManagerListener.kt @@ -15,6 +15,8 @@ class LWJGLExitMouseGrabDebuggerManagerListener : XDebuggerManagerListener { debugProcess.session.addSessionListener(object : XDebugSessionListener { override fun sessionPaused() { val evaluator = debugProcess.evaluator ?: return + + // older MC versions (lwjgl 2) ApplicationManager.getApplication().invokeLater { val expression = XExpressionImpl( /* expression = */ "Mouse.setGrabbed(false);", @@ -37,6 +39,31 @@ class LWJGLExitMouseGrabDebuggerManagerListener : XDebuggerManagerListener { /* expressionPosition = */ null, ) } + + // newer MC versions (lwjgl 3?) + ApplicationManager.getApplication().invokeLater { + val expression = XExpressionImpl( + /* expression = */ "MinecraftClient.getInstance().mouse.unlockCursor();\n" + + "MinecraftClient.getInstance().setScreenAndRender(MinecraftClient.getInstance().currentScreen);", + /* language = */ JavaLanguage.INSTANCE, + /* customInfo = */ "net.minecraft.client.MinecraftClient", + /* mode = */ EvaluationMode.CODE_FRAGMENT, + ) + evaluator.evaluate( + /* expression = */ expression, + /* callback = */ + object : XEvaluationCallbackBase() { + override fun errorOccurred(errorMessage: String) { + // ignore + } + + override fun evaluated(result: XValue) { + // ignore + } + }, + /* expressionPosition = */ null, + ) + } } }) }