Skip to content

Commit 071c879

Browse files
committed
Add weave plugin
1 parent 4b94610 commit 071c879

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
java
3+
id("com.github.weave-mc.weave") version "3ad11a0fd5"
34
}
45

56
group = "com.example"
@@ -22,4 +23,9 @@ tasks.jar {
2223
manifest.attributes(
2324
"Weave-Entry" to "com.example.mod.ExampleMod"
2425
)
26+
}
27+
28+
minecraft {
29+
version = "1.8.9"
30+
mappings = "stable_22"
2531
}

settings.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
rootProject.name = "ExampleMod"
22

3+
pluginManagement {
4+
repositories {
5+
gradlePluginPortal()
6+
maven("https://jitpack.io")
7+
}
8+
}

src/main/java/com/example/mod/ExampleMod.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
import club.maxstats.weave.loader.api.event.SubscribeEvent;
88
import club.maxstats.weave.loader.util.ExtensionsKt;
99
import kotlin.Unit;
10+
import net.minecraft.client.Minecraft;
11+
import net.minecraft.util.ChatComponentText;
1012
import org.jetbrains.annotations.NotNull;
13+
import org.lwjgl.input.Keyboard;
1114
import org.objectweb.asm.Opcodes;
1215
import org.objectweb.asm.Type;
1316
import org.objectweb.asm.tree.MethodInsnNode;
@@ -30,7 +33,9 @@ public void preinit(@NotNull HookManager hookManager) {
3033
});
3134

3235
EventBus.INSTANCE.subscribe(InputEvent.class, e -> {
33-
System.out.println("Pressed: " + e.getKeyCode());
36+
Minecraft.getMinecraft().thePlayer.addChatMessage(
37+
new ChatComponentText("Pressed: " + Keyboard.getKeyName(e.getKeyCode()))
38+
);
3439
});
3540
}
3641
public static void onStart() {

0 commit comments

Comments
 (0)