Interface not being added to class
I'm trying to make the Minecraft class implement my MinecraftBridge interface using
node.interfaces.add(Type.getInternalName(MinecraftBridge::class.java))
When I add it to my own MinecraftBridgeImpl class it adds fine using the same code but when I try to add it to the Minecraft class it doesnt add it. No errors are thrown it just writes it without the added interface.
Expected Behavior
The MinecraftBridge interface is added to the Minecraft class.
Current Behavior
The MinecraftBridge interface is not added to the Minecraft class.
Steps to Reproduce
This is the MinecraftBridge interface I'm trying to implement along with the LocalPlayerBridge
public interface LocalPlayerBridge {
void addChatMessage(String msg);
}
public interface MinecraftBridge {
LocalPlayerBridge getLocalPlayer();
}
val reader = ClassReader(/* The Minecraft class bytes */)
val node = ClassNode()
reader.accept(node, 0)
node.interfaces.add(Type.getInternalName(MinecraftBridge::class.java))
val cw = ClassWriter(reader, ClassWriter.COMPUTE_FRAMES)
node.accept(cw)
val bytes = cw.toByteArray()
Example Class Files
The .class is the original class I'm trying to add the interface to. The .modif.class is what ow2.asm
MinecraftPatch.class MinecraftPatch.modif.class
MinecraftBridgeImplPatch.class MinecraftBridgeImplPatch.modif.class