FabricMC / fabric-loader

Fabric's mostly-version-independent mod loader.
Apache License 2.0
632 stars 269 forks source link

Fabric Loader V 0.16.0 does not appear to accept `name=` for `@ModifyVariable` nor `@Local` #957

Open HydraheadHunter opened 3 months ago

HydraheadHunter commented 3 months ago

So, I was building a mod for 0.15.11 and someone slides into my issues section that it won't compile on FL 0.16.0..

Initial diagnosis is that this method is the problem:

@ModifyVariable(method= "internalOnSlotClick", at=@At("STORE"), name="n")
private int modifyItemStack2(int stackMaxCount, @Local(name="slot2") Slot slot, @Local(name="itemStack2") ItemStack stack )

After some fiddling, it turns out that the use of name="[name]" is the apparent problem as swapping it out for ordinals allowed the mod to function correctly (at least on my end: still waiting on confirmation for close the issue):

@ModifyVariable(method = "internalOnSlotClick", at = @At("STORE"), ordinal = 5)
private int modifyItemStack2(int stackMaxCount, @Local Slot slot, @Local(ordinal=0) ItemStack stack )

So to me, it appears that this mixin feature appears to be non-functional in FL 0.16.0.

LlamaLad7 commented 3 months ago

LVT names are debug info only and should not be used for MC code, as is explained in the @Local javadocs.

HydraheadHunter commented 3 months ago

Well, if that's the intended limitations of the code, I guess I'll have to live wit it not working. Tho it's weird that it worked perfectly well for me in v0.15.11.