illusivesoulworks / veinmining

Minecraft Mod: A lightweight, highly configurable Vein Mining enchantment for tools.
Other
30 stars 17 forks source link

[Bug]: Mixin incompatibility with Prism #66

Closed AHilyard closed 1 year ago

AHilyard commented 1 year ago

Minecraft Version

1.19.2

What happened?

When this mod is installed alongside Prism in a Fabric 1.19.2 instance, somehow one of Prism's mixins is skipped without any sort of warning or error. This is the mixin in question: https://github.com/AHilyard/Prism/blob/1.19-fabric/src/main/java/com/anthonyhilyard/prism/mixin/TextColorMixin.java This mixin adds an interface to the TextColor class and uses it for casts later, causing crashes when the mixin is skipped. I have tried to pin down the cause of this and it has eluded me, but I suspect it may have something to do with Fabric ASM. This behavior does not occur in Forge, even though the Forge version of Prism uses identical mixins.

How do you trigger this bug?

  1. Install Legendary Tooltips and Vein Mining together on a Fabric 1.19.2 instance.
  2. Launch Minecraft.
  3. Observe crash.

Loader

Fabric

Loader Version

Fabric 0.14.9, Fabric API 0.61.0

Mod Version

veinmining-fabric-1.0.0-beta.3+1.19.2 (also occurs on beta.1)

Relevant Log Outputs

https://pastebin.com/wwkR4TyG

TheIllusiveC4 commented 1 year ago

I have tried to pin down the cause of this and it has eluded me, but I suspect it may have something to do with Fabric ASM.

I also suspect this, as I needed to investigate a very similar issue https://github.com/illusivesoulworks/veinmining/issues/64, however I have yet to discover any useful results. Attempts to isolate Fabric ASM into a test mod and re-implementing similar code that I use for Vein Mining does not result in a crash, which is confusing to me because I have no idea what else it could possible be about the implementation that causes this kind of error.

I'll do some further tests involving some deeper alternate builds of Vein Mining to see if I can at least root out the cause.

TheIllusiveC4 commented 1 year ago

I ended up just removing Fabric ASM. Although this might cause some minor inconsistencies when other mods try and inspect the Vein Mining enchantment, I don't expect this to result in any significant issues and I, for now, don't see a viable alternative.

It's definitely something to do with Fabric ASM because that was the only thing I changed and the new build runs fine with both mods that cause this issue together with Vein Mining. However, as I said above, testing it with just Fabric ASM and a simple copy of a similar implementation does not yield any crashes so I don't know exactly what about it was causing the problem. I can only suspect it involves a very specific set of circumstances that I accidentally triggered but I wouldn't know where to begin to investigate on that front and I'm willing to settle with my current solution for the moment.

AHilyard commented 1 year ago

Wonderful, thank you for looking into this @TheIllusiveC4. Interestingly, I've found that other mods that are adding enchantment categories via Fabric ASM are encountering crashes as well (https://github.com/CrimsonDawn45/Fabric-Shield-Lib/issues/82), which indicates to me either a problem with Fabric ASM itself or just poor documentation on their part.