I'm trying to create a multi-loader, multi-Minecraft version project, but I'm encountering a strange issue:
In my project at common/src/main/java/io/homo/superresolution/core/graphics/impl/framebuffer/IFrameBuffer.java,
this is a framebuffer interface containing a method: void setClearColor(float red, float green, float blue, float alpha).
When running Minecraft in the development environment, the entire project works fine.
However, when I run Minecraft with the built mod file (production environment), I get:
java.lang.NoSuchMethodError: 'void io.homo.superresolution.core.graphics.impl.framebuffer.IFrameBuffer.setClearColor(float, float, float, float)'
at io.homo.superresolution.common.minecraft.HandRenderTarget.getHandRenderTarget(HandRenderTarget.java:15) ~[superresolution-forge-1.20.1-0.8.0-alpha.1.jar%23161!/:?] {re:classloading}
at io.homo.superresolution.common.minecraft.MinecraftRenderTargetType.lambda$static$6(MinecraftRenderTargetType.java:16) ~[superresolution-forge-1.20.1-0.8.0-alpha.1.jar%23161!/:?] {re:classloading}
at io.homo.superresolution.common.minecraft.MinecraftRenderTargetType.get(MinecraftRenderTargetType.java:25) ~[superresolution-forge-1.20.1-0.8.0-alpha.1.jar%23161!/:?] {re:classloading}
at io.homo.superresolution.common.minecraft.MinecraftRenderHandle.updateRenderTarget(MinecraftRenderHandle.java:118) ~[superresolution-forge-1.20.1-0.8.0-alpha.1.jar%23161!/:?] {re:mixin,re:classloading}
at io.homo.superresolution.common.minecraft.MinecraftRenderHandle.onRenderWorldBegin(MinecraftRenderHandle.java:165) ~[superresolution-forge-1.20.1-0.8.0-alpha.1.jar%23161!/:?] {re:mixin,re:classloading}
at net.minecraft.client.renderer.GameRenderer.handler$zzb000$onRenderWorldBegin(GameRenderer.java:1616) ~[client-1.20.1-20230612.114412-srg.jar%23162!/:?]
Later, I decompiled the built mod file and discovered that the setClearColor method was incorrectly obfuscated into void method_1236(float var1, float var2, float var3, float var4).
I then found that the Fabric-built mod also had this issue, confirming that the problem likely lies in the obfuscation of the common module.
I suspect this might be related to com.mojang.blaze3d.pipeline.RenderTarget's void setClearColor(float red, float green, float blue, float alpha) method,
because common/src/main/java/io/homo/superresolution/common/minecraft/LegacyStorageFrameBuffer.java implements IFrameBuffer while also extending RenderTarget.
As a test, I renamed the setClearColor method to _setClearColor_, and this build worked without issues.
Therefore, I believe the problem may stem from the legacyForge plugin (used in the common module).
Here is the pre-renaming IFrameBuffer.class, named IFrameBufferB.class
Here is the renamed IFrameBuffer.class, named IFrameBufferA.class
classes.zip
This is my project:
test.zip
I'm trying to create a multi-loader, multi-Minecraft version project, but I'm encountering a strange issue:
In my project at
common/src/main/java/io/homo/superresolution/core/graphics/impl/framebuffer/IFrameBuffer.java,this is a framebuffer interface containing a method:
void setClearColor(float red, float green, float blue, float alpha).When running Minecraft in the development environment, the entire project works fine.
However, when I run Minecraft with the built mod file (production environment), I get:
Later, I decompiled the built mod file and discovered that the
setClearColormethod was incorrectly obfuscated intovoid method_1236(float var1, float var2, float var3, float var4).I then found that the Fabric-built mod also had this issue, confirming that the problem likely lies in the obfuscation of the common module.
I suspect this might be related to com.mojang.blaze3d.pipeline.RenderTarget's
void setClearColor(float red, float green, float blue, float alpha)method,because
common/src/main/java/io/homo/superresolution/common/minecraft/LegacyStorageFrameBuffer.javaimplementsIFrameBufferwhile also extendingRenderTarget.As a test, I renamed the
setClearColormethod to_setClearColor_, and this build worked without issues.Therefore, I believe the problem may stem from the legacyForge plugin (used in the common module).
Here is the pre-renaming IFrameBuffer.class, named IFrameBufferB.class
Here is the renamed IFrameBuffer.class, named IFrameBufferA.class
classes.zip
This is my project:
test.zip