Skip to content

Commit 8c5b5ec

Browse files
committed
fixed the things + it builds now
1 parent aee4238 commit 8c5b5ec

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

build.gradle.kts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ sourceSets.main {
7272
repositories {
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

7977
val 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:

src/main/kotlin/com/github/subat0m1c/rawinput/mixin/MixinGuiMainMenu.java renamed to src/main/java/com/github/subat0m1c/rawinput/mixin/MixinGuiClose.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
package 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;
45
import org.spongepowered.asm.mixin.Mixin;
56
import org.spongepowered.asm.mixin.injection.At;
67
import org.spongepowered.asm.mixin.injection.Inject;
78
import 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
}

src/main/kotlin/com/github/subat0m1c/rawinput/RawInput.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)