a script mod enables you write asm codes in scripts.
Check Wiki for details.
#compiler javaShota
#import org.apache.logging.log4j.LogManager
#import org.apache.logging.log4j.Logger
System.out.print("Shota Strat his own tests!!! ^o^");
final Logger LOGGER = LogManager.getLogger("Cute shota");
LOGGER.info("Now, i have my own logger!!");
// Change the title
TransformerRegistry.registerASMExplicitTransformer(-99 ,
(cn) -> {
for (var mn :cn.methods) {
var itr = mn.instructions.iterator();
while (itr.hasNext()) {
if (itr.next() instanceof LdcInsnNode ldc && ldc.cst instanceof String str && str.startsWith("Cleanroom")) {
ldc.cst = str + " & Cute Shota";
LOGGER.info("change the title to {}", ldc.cst);
}
}
}
}, "net.minecraft.client.Minecraft");
// Arrors is infinite
TransformerRegistry.registerASMExplicitTransformer(-99 ,
(cn) -> {
for (var mn :cn.methods) {
if ("isInfinite".equals(mn.name)){
mn.instructions.clear();
mn.visitInsn(Opcodes.ICONST_1);
mn.visitInsn(Opcodes.IRETURN);
var itr = mn.instructions.iterator();
}
}
}, "net.minecraft.item.ItemArrow");