
[Bug] SpriteLoader Mixin conflict with Petrolpark's Library causing Connected Textures to render incorrectly
petrolpark opened this issue · 2 comments
Version Info
- Minecraft, 1.21.1
- Fusion, 1.2.10
What mod loader are you using?: NeoForge
Are you using OptiFine: No
Description of the Bug
SpriteLoaderMixin
(and presumably other mixins) use @Inject
where @ModifyReturnValue
or @WrapMethod
from MixinExtras would perhaps be more appropriate. I believe this is causing this problem, as I have explained in that issue's discussion, though admittedly this is only my first instinct and the problem may be on my library's end. Either way it would be good future-proofing to use MixinExtras.
SpriteLoaderMixin
(and presumably other mixins) use@Inject
where@ModifyReturnValue
or@WrapMethod
from MixinExtras would perhaps be more appropriate.
@Inject
just injects the method at some point in the target method. As long as the injection does not cancel the method, that is completely fine and has no compatibility issues. MixinExtras does not have anything to replace regular @Inject
s as there is no reason to.
The issue seems to be caused by SpriteLoaderMixin
from Petrolpark Library. The mixin overwrites the set of metadata section serializers given to SpriteLoader#loadAndStitch
with OffGridTilingMetadataSection#DEFAULT_METADATA_SERIALIZERS_WITH_OGT
which contains just OffGridTilingMetadataSection
serializer and the vanilla animation metadata serializer.
This means all other metadata, like those from other mods such as Fusion, will be ignored with Petrolpark Library installed.
Fusion adds a new metadata section for specifying Fusion texture types and properties. Since the metadata is now ignored, none of the textures using Fusion will work.
Easiest way to add a texture metadata serializer is simply adding your metadata serializer to SpriteLoader#DEFAULT_METADATA_SECTIONS
such that it is compatible with other mods adding metadata sections.
I do the same in Fusion here:
Fusion/src/main/java/com/supermartijn642/fusion/FusionClient.java
Lines 79 to 83 in 2365935