Skip to content

Commit beba556

Browse files
committed
setup mixins using normal mixins
1 parent 00cdc25 commit beba556

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,21 @@ apiPackage =
7474
accessTransformersFile =
7575

7676
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
77-
usesMixins = false
77+
usesMixins = true
7878

7979
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
8080
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
8181
# Mixin classes will have access to "main" classes, but not the other way around.
8282
separateMixinSourceSet =
8383

8484
# Adds some debug arguments like verbose output and class export.
85-
usesMixinDebug = false
85+
usesMixinDebug = true
8686

8787
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
8888
mixinPlugin =
8989

9090
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
91-
mixinsPackage =
91+
mixinsPackage = mixins
9292

9393
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
9494
# This parameter is for legacy compatibility only
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.myname.mymodid.mixins;
2+
3+
import net.minecraft.client.Minecraft;
4+
5+
import org.spongepowered.asm.mixin.Mixin;
6+
import org.spongepowered.asm.mixin.injection.At;
7+
import org.spongepowered.asm.mixin.injection.Inject;
8+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
9+
10+
@Mixin(Minecraft.class) // the class targeted by this mixin
11+
public class MixinMinecraft_Example { // This is an example you should delete this class
12+
13+
@Inject(method = "startGame", at = @At("TAIL"))
14+
private void example$sayHello(CallbackInfo ci) {
15+
// this line of code will be injected at the end of the method "startGame" in the Minecraft class
16+
System.out.println("Example mod says Hello from within Minecraft.startGame()!");
17+
}
18+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"required": true,
3+
"minVersion": "0.8.5-GTNH",
4+
"package": "com.myname.mymodid.mixins",
5+
"refmap": "mixins.mymodid.refmap.json",
6+
"target": "@env(DEFAULT)",
7+
"compatibilityLevel": "JAVA_8",
8+
"mixins": [],
9+
"client": ["MixinMinecraft_Example"],
10+
"server": []
11+
}

0 commit comments

Comments
 (0)