summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
author alemidev <me@alemi.dev>2023-02-07 12:47:10 +0100
committer alemidev <me@alemi.dev>2023-02-07 12:47:10 +0100
commit9f2777dedb1026da602d530c02bd7959a240e17e (patch)
tree3a7d2715dbb4596509ef5b2f3bb5132d3d9c4613 /README.md
parent5b574a7cbf6b09b60f2eaaff0a0711c38f261b8d (diff)
docs: added README.md
Diffstat (limited to 'README.md')
-rw-r--r--README.md41
1 files changed, 41 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..5a7c79f
--- /dev/null
+++ b/README.md
@@ -0,0 +1,41 @@
+# lillero
+*don't do coremods*
+
+A simple and slim ASM patching framework, allowing to modify block game code.
+
+## How
+This library provides the core interface: `IInjector`. All patches which implement this interface and are defined as services will be loaded and applied at startup.
+
+Some methods must be implemented, specifying which class and method will be patched:
+ * `targetClass()` : returns full name of class to patch (such as `net.minecraft.client.Minecraft`)
+ * `methodName()` : returns name (Searge obfuscated) of method to patch
+ * `methodDesc()` : returns descriptor (arguments and return type) of method to patch
+ * `inject(ClassNode clazz, MethodNode method)` : will be invoked providing correct class and method. This is where the actual patching happens
+Some extra methods should also be implemented to help identify your patch:
+ * `name()` : returns patch name
+ * `reason()` : returns patch description
+
+To make your classes service providers, a simple text file should be defined under `src/main/resources/META-INF/services` in your mod project: `ftbsc.lll.IInjector`. Inside such file, put full class paths of your patches.
+
+To load patches created with this library, a Launch Plugin loader is necessary (such as our [lillero-loader](https://git.fantabos.co/lillero-loader/))
+
+### Example
+```java
+// file src/main/java/example/patches/SamplePatch.java
+package example.patches;
+import ftbsc.lll.IInjector;
+public class SamplePatch implements IInjector {
+ public String name() { return "SamplePatch"; }
+ public String targetClass() { return "net.minecraft.client.Minecraft"; }
+ public String methodName() { return "func_71407_l"; } // tick()
+ public String methodDesc() { return "()V"; }
+ public void inject(ClassNode clazz, MethodNode main) {
+ InsnList insnList = new InsnList();
+ insnList.add(new InsnNode(POP));
+ main.instructions.insert(insnList);
+ }
+}
+
+// file src/main/resources/META-INF/services/ftbsc.lll.IInjector
+example.patches.SamplePatch
+```