File tree Expand file tree Collapse file tree 9 files changed +181
-4
lines changed
java/com/myname/mymodid/mixins Expand file tree Collapse file tree 9 files changed +181
-4
lines changed Original file line number Diff line number Diff line change @@ -74,26 +74,26 @@ apiPackage =
74
74
accessTransformersFile =
75
75
76
76
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
77
- usesMixins = false
77
+ usesMixins = true
78
78
79
79
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
80
80
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
81
81
# Mixin classes will have access to "main" classes, but not the other way around.
82
82
separateMixinSourceSet =
83
83
84
84
# Adds some debug arguments like verbose output and class export.
85
- usesMixinDebug = false
85
+ usesMixinDebug = true
86
86
87
87
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
88
88
mixinPlugin =
89
89
90
90
# 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
92
92
93
93
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
94
94
# This parameter is for legacy compatibility only
95
95
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
96
- coreModClass =
96
+ coreModClass = mixins.EarlyMixinsLoader
97
97
98
98
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
99
99
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
Original file line number Diff line number Diff line change
1
+ package com .myname .mymodid .mixins ;
2
+
3
+ import com .gtnewhorizon .gtnhmixins .IEarlyMixinLoader ;
4
+ import com .gtnewhorizon .gtnhmixins .builders .IMixins ;
5
+ import cpw .mods .fml .relauncher .IFMLLoadingPlugin ;
6
+
7
+ import java .util .List ;
8
+ import java .util .Map ;
9
+ import java .util .Set ;
10
+
11
+ @ IFMLLoadingPlugin .MCVersion ("1.7.10" )
12
+ public class EarlyMixinsLoader implements IFMLLoadingPlugin , IEarlyMixinLoader {
13
+
14
+ @ Override
15
+ public String [] getASMTransformerClass () {
16
+ return null ;
17
+ }
18
+
19
+ @ Override
20
+ public String getModContainerClass () {
21
+ return null ;
22
+ }
23
+
24
+ @ Override
25
+ public String getSetupClass () {
26
+ return null ;
27
+ }
28
+
29
+ @ Override
30
+ public void injectData (Map <String , Object > data ) {}
31
+
32
+ @ Override
33
+ public String getAccessTransformerClass () {
34
+ return null ;
35
+ }
36
+
37
+ @ Override
38
+ public String getMixinConfig () {
39
+ // rename the associated .json file by replacing the "mymodid" with your own mod ID
40
+ // in the .json file edit the "package" and "refmap" properties to match your mod
41
+ // also edit the "refmap" property in the "mixins.mymodid.json" file
42
+ return "mixins.mymodid.early.json" ;
43
+ }
44
+
45
+ @ Override
46
+ public List <String > getMixins (Set <String > loadedCoreMods ) {
47
+ return IMixins .getEarlyMixins (Mixins .class , loadedCoreMods );
48
+ }
49
+ }
Original file line number Diff line number Diff line change
1
+ package com .myname .mymodid .mixins ;
2
+
3
+ import com .gtnewhorizon .gtnhmixins .ILateMixinLoader ;
4
+ import com .gtnewhorizon .gtnhmixins .LateMixin ;
5
+ import com .gtnewhorizon .gtnhmixins .builders .IMixins ;
6
+
7
+ import javax .annotation .Nonnull ;
8
+ import java .util .List ;
9
+ import java .util .Set ;
10
+
11
+ // The annotation is required, it indicates to
12
+ // the mixins framework to instantiate this class
13
+ // and look for LateMixins to load.
14
+ @ LateMixin
15
+ public class LateMixinsLoader implements ILateMixinLoader {
16
+
17
+ @ Override
18
+ public String getMixinConfig () {
19
+ // rename the associated .json file by replacing the "mymodid" with your own mod ID
20
+ // in the .json file edit the "package" and "refmap" properties to match your mod
21
+ // also edit the "refmap" property in the "mixins.mymodid.json" file
22
+ return "mixins.mymodid.late.json" ;
23
+ }
24
+
25
+ @ Nonnull
26
+ @ Override
27
+ public List <String > getMixins (Set <String > loadedMods ) {
28
+ return IMixins .getLateMixins (Mixins .class , loadedMods );
29
+ }
30
+ }
Original file line number Diff line number Diff line change
1
+ package com .myname .mymodid .mixins ;
2
+
3
+ import com .gtnewhorizon .gtnhmixins .builders .IMixins ;
4
+ import com .gtnewhorizon .gtnhmixins .builders .MixinBuilder ;
5
+
6
+ import javax .annotation .Nonnull ;
7
+
8
+ public enum Mixins implements IMixins {
9
+
10
+ // Read the java doc of IMixins and MixinBuilder for further information
11
+
12
+ // You should declare all of your mixins early and late in this same enum
13
+
14
+ EXAMPLE (new MixinBuilder ()
15
+ .setPhase (Phase .EARLY )
16
+ .addClientMixins ("MixinMinecraft_Example" ));
17
+
18
+ private final MixinBuilder builder ;
19
+
20
+ Mixins (MixinBuilder builder ) {
21
+ this .builder = builder ;
22
+ }
23
+
24
+ @ Nonnull
25
+ @ Override
26
+ public MixinBuilder getBuilder () {
27
+ return builder ;
28
+ }
29
+ }
Original file line number Diff line number Diff line change
1
+ package com .myname .mymodid .mixins ;
2
+
3
+ import com .gtnewhorizon .gtnhmixins .builders .ITargetMod ;
4
+ import com .gtnewhorizon .gtnhmixins .builders .TargetModBuilder ;
5
+
6
+ import javax .annotation .Nonnull ;
7
+
8
+ public enum TargetMods implements ITargetMod {
9
+
10
+ // Read the java doc of ITargetMod and TargetModBuilder for further information
11
+
12
+ // Add to this enum information about the mods you need to identify during runtime
13
+
14
+ COFHCORE ("cofh.asm.LoadingPlugin" , "CoFHCore" ),
15
+ OPTIFINE ("optifine.OptiFineForgeTweaker" , "Optifine" );
16
+
17
+ private final TargetModBuilder builder ;
18
+
19
+ TargetMods (String coreModClass , String modId ) {
20
+ this .builder = new TargetModBuilder ().setCoreModClass (coreModClass ).setModId (modId );
21
+ }
22
+
23
+ @ Nonnull
24
+ @ Override
25
+ public TargetModBuilder getBuilder () {
26
+ return builder ;
27
+ }
28
+ }
Original file line number Diff line number Diff line change
1
+ package com .myname .mymodid .mixins .early ;
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
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "required" : true ,
3
+ "minVersion" : " 0.8.5-GTNH" ,
4
+ "package" : " com.myname.mymodid.mixins.early" ,
5
+ "refmap" : " mixins.mymodid.refmap.json" ,
6
+ "target" : " @env(DEFAULT)" ,
7
+ "compatibilityLevel" : " JAVA_8"
8
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "required" : true ,
3
+ "minVersion" : " 0.8.5-GTNH" ,
4
+ "refmap" : " mixins.mymodid.refmap.json" ,
5
+ "target" : " @env(DEFAULT)" ,
6
+ "compatibilityLevel" : " JAVA_8"
7
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "required" : true ,
3
+ "minVersion" : " 0.8.5-GTNH" ,
4
+ "package" : " com.myname.mymodid.mixins.late" ,
5
+ "refmap" : " mixins.mymodid.refmap.json" ,
6
+ "target" : " @env(DEFAULT)" ,
7
+ "compatibilityLevel" : " JAVA_8"
8
+ }
You can’t perform that action at this time.
0 commit comments