File tree Expand file tree Collapse file tree 3 files changed +16
-13
lines changed
java/com/github/subat0m1c/rawinput/mixin
kotlin/com/github/subat0m1c/rawinput Expand file tree Collapse file tree 3 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -72,8 +72,6 @@ sourceSets.main {
7272repositories {
7373 mavenCentral()
7474 maven(" https://repo.spongepowered.org/maven/" )
75- // If you don't want to log in with your real minecraft account, remove this line
76- maven(" https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1" )
7775}
7876
7977val shadowImpl: Configuration by configurations.creating {
@@ -85,17 +83,15 @@ dependencies {
8583 mappings(" de.oceanlabs.mcp:mcp_stable:22-1.8.9" )
8684 forge(" net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9" )
8785
86+ implementation(" org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4" )
87+
8888 shadowImpl(kotlin(" stdlib-jdk8" ))
8989
9090 // If you don't want mixins, remove these lines
9191 shadowImpl(" org.spongepowered:mixin:0.7.11-SNAPSHOT" ) {
9292 isTransitive = false
9393 }
9494 annotationProcessor(" org.spongepowered:mixin:0.8.5-SNAPSHOT" )
95-
96- // If you don't want to log in with your real minecraft account, remove this line
97- runtimeOnly(" me.djtheredstoner:DevAuth-forge-legacy:1.2.1" )
98-
9995}
10096
10197// Tasks:
Original file line number Diff line number Diff line change 11package com .github .subat0m1c .rawinput .mixin ;
22
3- import net .minecraft .client .gui .GuiMainMenu ;
3+ import com .github .subat0m1c .rawinput .RawInput ;
4+ import net .minecraft .client .Minecraft ;
45import org .spongepowered .asm .mixin .Mixin ;
56import org .spongepowered .asm .mixin .injection .At ;
67import org .spongepowered .asm .mixin .injection .Inject ;
78import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
89
9- @ Mixin (GuiMainMenu .class )
10- public class MixinGuiMainMenu {
10+ @ Mixin (Minecraft .class )
11+ public class MixinGuiClose {
1112
12- @ Inject (method = "initGui " , at = @ At ("HEAD" ))
13- public void onInitGui (CallbackInfo ci ) {
14- System . out . println ( "Hello from Main Menu!" );
13+ @ Inject (method = "setIngameFocus " , at = @ At ("HEAD" ))
14+ void onClose (CallbackInfo ci ) {
15+ RawInput . guiClosed ( );
1516 }
1617}
Original file line number Diff line number Diff line change @@ -32,6 +32,12 @@ object RawInput {
3232 rawInputJob = launchRawInput()
3333 }
3434
35+ @JvmStatic
36+ fun guiClosed () {
37+ dx = 0
38+ dy = 0
39+ }
40+
3541 private fun launchRawInput () = scope.launch {
3642 controllers?.let { controllers ->
3743 while (enabled) {
@@ -42,7 +48,7 @@ object RawInput {
4248 val mouseController = controller as Mouse
4349 if (mouseController.x.pollData != 0f || mouseController.y.pollData != 0f ) {
4450 mouse = mouseController
45- mc.thePlayer?.addChatMessage(ChatComponentText (" Mouse found: ${mouseController.name} " ) as IChatComponent ) ? : println (" Mouse found: ${mouseController.name} " )
51+ mc.thePlayer?.addChatMessage(ChatComponentText (" Mouse found: ${mouseController.name} " )) ? : println (" Mouse found: ${mouseController.name} " )
4652 break
4753 }
4854 }
You can’t perform that action at this time.
0 commit comments