[1.20.1 Fabric] Incompatible mining speed mixin
TelepathicGrunt opened this issue ยท 2 comments
Artifact's digging claw mixin into Player Entity is incompatible with my Bumblezone mod's mixin. My mixin's goal is to increase mining speed on certain blocks if the player has Comb Cutter enchantment on their item. I do this with a ModifyReturnValue mixin from MixinExtras.
https://github.com/TelepathicGrunt/Bumblezone/blob/1.20-Arch/fabric-base/src/main/java/com/telepathicgrunt/the_bumblezone/mixin/fabricbase/entity/PlayerMixin.java#L49
The issue is Artifact's mixin here is an inject at return with setting the setReturnValue always which effectively a cancel always.
Looking at the mixin output class, you can see how because Artifacts is always calling setReturnValue unconditionally, it will always set isCancelled to true and take the Artifacts value while never running the Bumblezone mixin ever
Thus causing incompatibility with my mod. I strongly recommend switching to ModifyReturnValue like me as ModifyReturnValue is safer and allows stacking properly. An inject with an unconditional cancel/setting value is worse than an overwrite because the incompat is much harder to find. If you do inject, always add an if statement of some sort of narrow condition if you much cancel/set a value in an inject. Otherwise, ModifyReturnValue is the proper solution here
Thanks for reporting this. A lot of Artifact's mixins have been around since before mixin extras. I'll do a quick review of every mixin, and replace with compatible alternatives where possible.