Skip to content

Commit c8c038f

Browse files
committed
Mixins
1 parent 51ef9a5 commit c8c038f

File tree

5 files changed

+36
-9
lines changed

5 files changed

+36
-9
lines changed

build.gradle.kts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,15 @@ minecraft.version("1.8.9")
1010

1111
repositories {
1212
maven("https://jitpack.io")
13+
maven("https://repo.spongepowered.org/maven/")
1314
}
1415

1516
dependencies {
16-
compileOnly("com.github.weave-mc:weave-loader:96b318be13")
17+
compileOnly("com.github.weave-mc:weave-loader:2e22997d5b")
18+
19+
compileOnly("org.spongepowered:mixin:0.8.5")
1720
}
1821

1922
tasks.compileJava {
2023
options.release.set(11)
21-
}
22-
23-
tasks.jar {
24-
manifest.attributes(
25-
"Weave-Entry" to "com.example.mod.ExampleMod"
26-
)
27-
}
24+
}

src/main/java/com/example/mod/hook/MinecraftHook.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ public void transform(@NotNull ClassNode classNode, @NotNull AssemblerConfig ass
2929

3030
@SuppressWarnings("unused")
3131
public static void onStartGame() {
32-
System.out.println("onStartGame");
32+
System.out.println("Hook Test");
3333
}
3434
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.example.mod.mixins;
2+
3+
import net.minecraft.client.Minecraft;
4+
import org.spongepowered.asm.mixin.Mixin;
5+
import org.spongepowered.asm.mixin.injection.At;
6+
import org.spongepowered.asm.mixin.injection.Inject;
7+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
8+
9+
@Mixin(Minecraft.class)
10+
public abstract class MinecraftMixin {
11+
@Inject(method = "startGame", at = @At("HEAD"))
12+
public void onStartGame(CallbackInfo ci) {
13+
System.out.println("Mixin Test");
14+
}
15+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"compatibilityLevel": "JAVA_8",
3+
"package": "com.example.mod.mixins",
4+
"mixins": [
5+
"MinecraftMixin"
6+
]
7+
}

src/main/resources/weave.mod.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"mixins": [
3+
"examplemod.mixins.json"
4+
],
5+
"entrypoints": [
6+
"com.example.mod.ExampleMod"
7+
]
8+
}

0 commit comments

Comments
 (0)