An annotation processor to kill Lillero's boilerplate https://docs.zaaarf.foo/lillero-processor/
Find a file
2023-03-17 19:09:32 +01:00
gradle/wrapper chore: replaced gradlew, these ones should work 2023-02-27 14:43:26 +01:00
src/main fix: fixed NoClassDefFoundError for non-java classes 2023-03-17 19:09:32 +01:00
.gitignore gitignore: fixed 2023-02-24 03:06:14 +01:00
build.gradle feat: initial implementation of new system 2023-03-08 15:37:17 +01:00
gradlew chore: replaced gradlew, these ones should work 2023-02-27 14:43:26 +01:00
gradlew.bat chore: replaced gradlew, these ones should work 2023-02-27 14:43:26 +01:00
README.md doc: small readme fix 2023-02-27 10:45:21 +01:00
settings.gradle feat: initial commit, limited implementation of the annotation processor 2023-02-24 03:03:23 +01:00

Lillero-processor

Lillero-processor is an annotation processor made to simplify development of Lillero patches, minimising the amount of boilerplate code needed.

How to use

First things first, add the processor and its dependencies to your build.gradle:

dependencies {
	implementation 'ftbsc.lll:processor:0.1.0'
	annotationProcessor 'com.squareup:javapoet:1.13.0'
	annotationProcessor 'ftbsc:lll:0.2.1'
	annotationProcessor 'ftbsc.lll:processor:0.1.0'
}

That's about all the effort you need to put in! Now, this:

package example.patches;
import net.minecraft.client.Minecraft;
import ftbsc.lll.processor.annotations.*;
@Patch(value = Minecraft.class, reason = "crash the game as soon as it loads")
public class SamplePatch implements Opcodes {
	@Target
	public void tick() {}; //stub representing the target method, its modifiers are irrelevant
	@Injector
	public static void yourCustomInjector(ClassNode clazz, MethodNode main) {
		InsnList insnList = new InsnList();
		insnList.add(new InsnNode(POP));
		main.instructions.insert(insnList);
	}
}

will automatically generate:

package example.patches;
import ftbsc.lll.IInjector;
public class SamplePatchInjector implements IInjector {
	public String name()        { return "SamplePatch"; }
	public String reason()      { return "crash the game as soon as it loads"; }
	public String targetClass() { return "net.minecraft.client.Minecraft"; }
	public String methodName()  { return "func_71407_l"; } // tick()
	public String methodDesc()  { return "()V"; } // void, no args 
	public void inject(ClassNode clazz, MethodNode main) {
		SamplePatch.yourCustomInjector(clazz, main);
	}
}

Happy patching!