FabricMC / fabric-loom

Gradle build system plugin used to automate the setup of a minecraft mod development environment.
MIT License
221 stars 193 forks source link

Transitive Access Wideners seem to break under certain circumstances. #1095

Open Witixin1512 opened 2 months ago

Witixin1512 commented 2 months ago

At some point when adding more than one TAW that applies to the same class, Loom seems to be unable to remap code using that properly. This results in consumer mods of the one using the transitive access wideners seeing weird methods being invoked.

The following access widener file is enough to trigger this:

accessWidener v2 named

transitive-accessible field net/minecraft/client/render/WorldRenderer bufferBuilders Lnet/minecraft/client/render/BufferBuilderStorage;
transitive-accessible method net/minecraft/client/render/WorldRenderer canDrawEntityOutlines ()Z

I've made two minimal reproduction projects, one that publishes to mavenLocal, and one that consumes the dependency from mavenLocal. They are https://github.com/WitixinForks/fabric-taw-publisher and https://github.com/WitixinForks/fabric-taw-consumer.

The original class looks like this:

public class ClientOnlyClass {

    public static void isThisRemapped() {
        MinecraftClient mc = MinecraftClient.getInstance();
        VertexConsumerProvider bufferSource =  mc.worldRenderer.bufferBuilders.getEntityVertexConsumers();
    }
}

However it appears to consumers like this:

public class ClientOnlyClass {
    public static void isThisRemapped() {
        MinecraftClient mc = MinecraftClient.getInstance();
        VertexConsumerProvider bufferSource =  mc.worldRenderer.bufferBuilders.method_23000();
    }
}