Mineuniverse
Log in Register
Mods

MCFA

A simple library mod that allows other mods to easily do low level bytecode modifications.
by gudenau
Download Claim this project
52 downloads
0 likes
Updated Jul 6, 2026
0 hypes
API and Library

A small library mod that allows other mods to use the Java 24 ClassFile API to directly edit the code of classes as they are loaded.

 

A simple example implementation could be:

public class Example implements McfaInitializer {
@Override
public void initializeTransformers(@NotNull Mcfa registry) {
registry.registerTransformer(
"net.minecraft.class_310",
ClassTransform.transformingMethods(
MethodTransform.transformingCode(
(builder, element) -> {
var result = switch(element) {
case ConstantInstruction instruction -> switch(instruction.typeKind()) {
case REFERENCE -> {
var value = instruction.constantValue();
if(value.equals("Setting user: {}")) {
builder.ldc("This got changed via the ClassFile API :-) {}");
yield true;
}

yield false;
}

default -> false;
};

default -> false;
};
if(result) {
return;
}

builder.with(element);
}
)
)
);
}
}
gud_mcfa-1.0.0.jar
MC 1.21.2-Snapshot, 1.21, 1.21.5, Fabric, Client, 1.21.1-Snapshot, 1.21.4, 1.21.5-Snapshot, 1.21-Snapshot, 1.21.3, 1.21.1, Server, 1.21.4-Snapshot, 1.21.2
Release 2025-03-30 Get

More from gudenau

Coolers
83,550
CorsairCraft
817
GudLib
37,812
Random Textures
3,698
Recipe Confidence
3,688
Fabric Core Mods
350

You Might Also Like

Vivecraft
A Minecraft VR mod on a loader of your choice!
9,988,339
Athena
A crossplatform (Forge/Fabric) solution to connected block textures for 1.19.4+
99,799,527
Lodestone
A collection of code used throughout projects under the Lodestar team.
9,914,417
TheDragonLib
A library for most of sokratis12GR's Mods
9,910,232
Multi Mob Library
A library mod containing essential files for Daveyx0's mob mods
9,892,767
FTB Library (Forge) (Legacy)
FTB Library is a library mod that is used for some of our mods.
98,265,314