your current location:首页 > news>! MixinBooter usage method (for developer)

! MixinBooter usage method (for developer)

2024-12-10 17:47:34|Myriagame |source:minecraft skins

This tutorial is set by the author's setting without permission.

This article mainly introduces the method of using MixinBooter to guide Mixin.

MixinBooter can greatly simplify Mixin's guidance, but its description on the homepage of MCMOD and github is very unclear.

I took a lot of detours in the process of using this module.

The main content is not guaranteed to be completely correct for yourself.

refer to:

https://github.com/lolikingDom/loliasm

https://github.com/lolikingDom/mixinbooter

first step:

Modification of Build.gradle

Including universal mixin configuration

Not the only way to write, for reference only

 Buildscript {

Repositories {

... (omitted)

Maven {

Name = 'mixingradle'

Url = 'https://repo.spongepowered.org/repository/maven-public'

}

}

Dependencies {

Classpath "org.spongepowered: mixingradle: 0.7-Snapshot"

}

}

... (omitted)

Apply plugin: 'org.spongepowered.mixin'

... (omitted)

dependencies {

// This represents the forge version I use

Minecraft 'net.minecraftForge: Forge: 1.12.2-14.5.5.2860'

... (omitted)

Implementation fg.deobf ("Zone.RONG: MIXINBOOTER: $ {mixinbooter_version}")

AnnotationProcessor 'ORG.SPONGEPORED: mixin: 0.8.5: Processor'

}

... (omitted)

jar {{

Manifest {

Attributes ([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[

// Related to loading Earlymixin 'FMLCOREPLUGINTAINSFMLMOD': TRUE,

//"Com.yourname.modid. "

'Fmlcoreplugin': 'com.yourname.modid.mixinit.earlymixininit',

// Maybe not appropriate? But it can run

"Forceloadasmod": true, True,

... (omitted)

])

}

}

// The common mixin configuration can refer to other MIXIN tutorials to fill in. Be careful not to fill in the config here.

mixin {

// Change to your own Modid. In fact, the name of this Refmap can be changed elsewhere

Add sources.main, "mixins.modid.refmap.json"

Debug.export = TRUE

}

Step 2: Use MixinBooter to guide MIXIN

1.mixin third -party module

Please give a class to realize ILateMixinloader

@SUPPRESSWARNINGS ("Unused")

// No @mixinloader or other annotations, mixinbooter will find this class

Public Class LateMixinit Implements Ilatemixinloader {

// icatemixinloader interface has only one way you want to implement. You return here to the config file name of the third -party module Mixin.

@Override

Public list getmixinconfigs () {{)

Return lists.newarraylist ("mixins.gregica_late.json");

}

}

2. Mixin original or forge

You need to give a class to realize iFmlloadingplugin and IEarlymixinloader. This class is used before

@SUPPRESSWARNINGS ("Unused")

@IFMLLOADINGPLUGIN.NAME (Gregica.mod_id)

@IFMLLOADINGPLUGIN.MCVERSION (forgeversion.mcversion)

Public Class Earlymixinit Implements iFMLLOADINGPLUGIN, IEarlymixinLoader {

// This is the real UnusEd (

Public Static Final Boolean IsClient = FMLLAUNCHANDLER.SIDE () == SIDE.Client;

// The same reasoning with Ilatedmixinloader is just the same, but the config file given here is used to describe the original version of the mixin or forge class

@Override

Public list getmixinconfigs () {{)

Return Collections.SINGLETONList ("mixins.gregica_early.json");

}

// Below IFMLLOADINPLUGIN and IEARLYMIXINLOADER give a lot

// For specific use, please refer to loliasm

@Override

Public string [] GetasmtransformerClass () {) {)

Return New String [0];

}

@Override

Public string getModContainerss () {) {

Return null;

}

@Nullable

@Override

Public String GetSetupClass () {) {)

Return null;

}

@Override

Public void InjectData (MAP Data) {

}

@Override

Public string getaccessstransformerClass () {) {) {

Return null;

}

}

Step 3: About Mixin's config

In fact, there are not too many mixinbootr content here a example

mixins.gregica_late.json

 {{

"Minversion": "0.7",

// Change yourself

"Package": "Your.package.name.mixin",

"CompatibilityLevel": "java_8",, "java_8",

// Please search for the tutorial of the Mixin plug -in.

"Plugin": "Your.package.name.mixininit.gcmixinfigPlugin",,

"Target": "@env (default)",

// Note that it is consistent with the filling in the built.gradle

"Refmap": "mixins.modid.refmap.json",

"Mixins": [[

// The name of Mixin at both ends

],,,

"Client": [[

// On the name of Mixin on the physical client],],

"Server": [

// On the physical service side, Mixin's class name

],,,

"Injectors": {

"DefaultRequire": 1

}

}

That's it to talk about it, but it can make you easily guide Mixin, rest assured to write mixin instead