Skip to content

Interface-injected method target containing MC classes missing from generated refmap when in subproject #1355

@DanyGames2014

Description

@DanyGames2014

When I have this mixin inside of a subproject, it does not get remapped and added to the refmap, this results in the game crashing when it encounters that mixin.

Caused by: org.spongepowered.asm.mixin.injection.throwables.InjectionError: Critical injection failure: Callback method aaa(Lnet/minecraft/class_17;Lnet/minecraft/class_18;IIILnet/modificationstation/stationapi/api/block/BlockState;)Z in nyalib-base.mixins.json:network.FlattenedChunkMixin from mod nyalib-base failed injection check, (0/1) succeeded. Scanned 0 target(s). Using refmap nyalib-base-refmap.json
	at org.spongepowered.asm.mixin.injection.struct.InjectionInfo.postInject(InjectionInfo.java:531)
	at knot//com.llamalad7.mixinextras.injector.MixinExtrasLateInjectionInfo.latePostInject(MixinExtrasLateInjectionInfo.java:57)
	at knot//com.llamalad7.mixinextras.injector.LateInjectionApplicatorExtension.postApply(LateInjectionApplicatorExtension.java:43)
	at org.spongepowered.asm.mixin.transformer.ext.Extensions.postApply(Extensions.java:167)
	at org.spongepowered.asm.mixin.transformer.TargetClassContext.postApply(TargetClassContext.java:448)
	at org.spongepowered.asm.mixin.transformer.TargetClassContext.applyMixins(TargetClassContext.java:420)
	at org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:352)
	... 42 more

Other mixins in the same package get remapped just fine

Here is the mixin which fails to be remapped. FlattenedChunk extends vanilla Chunk, the method I am targetting is interface-injected into the Block class

@Mixin(FlattenedChunk.class)
public class FlattenedChunkMixin {
    @WrapWithCondition(method = "setBlockState", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/Block;onBlockPlaced(Lnet/minecraft/world/World;IIILnet/modificationstation/stationapi/api/block/BlockState;)V"))
    public boolean aaa(Block block, World world, int x, int y, int z, BlockState oldState) {
        if (block instanceof NetworkComponent && oldState.isOf(block)) {
            // Supress the onBlockPlaced method call
            return false;
        }
        return true;
    }
}

And these are the refmaps, taken from an earlier version of the mod from when it was not modularized:
These are currently missing in the newest versions, causing the crash

{
  "mappings": {
    "net/danygames2014/nyalib/mixin/network/FlattenedChunkMixin": {
      "Lnet/minecraft/block/Block;onBlockPlaced(Lnet/minecraft/world/World;IIILnet/modificationstation/stationapi/api/block/BlockState;)V": "Lnet/minecraft/class_17;onBlockPlaced(Lnet/minecraft/class_18;IIILnet/modificationstation/stationapi/api/block/BlockState;)V"
    }
  },
  "data": {
    "named:intermediary": {
      "net/danygames2014/nyalib/mixin/network/FlattenedChunkMixin": {
        "Lnet/minecraft/block/Block;onBlockPlaced(Lnet/minecraft/world/World;IIILnet/modificationstation/stationapi/api/block/BlockState;)V": "Lnet/minecraft/class_17;onBlockPlaced(Lnet/minecraft/class_18;IIILnet/modificationstation/stationapi/api/block/BlockState;)V"
      }
    }
  }
}

The buildscript: https://github.com/DanyGames2014/nyalib/blob/master/build.gradle
The mixin https://github.com/DanyGames2014/nyalib/blob/master/nyalib-base/src/main/java/net/danygames2014/nyalib/mixin/network/FlattenedChunkMixin.java

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions