-
-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Private Method Support in Interface Mixins #497
Comments
It's not "too aggressive", this is by design, so it's exactly as aggressive as it was intended to be. Changes are coming in 0.9 which address this and other issues which affect manipulation of interfaces and default methods. |
I don't reject the fact that it's by design, I badly worded that part, but my point is some checks can end up more frustrating than it should for a mixin user. |
forge version can not launch due to a bug of the dependency. SpongePowered/Mixin#497 FabricMC/Mixin#54
forge version can not launch due to a bug of the dependency. SpongePowered/Mixin#497 FabricMC/Mixin#54
forge version can not launch due to a bug of the dependency. SpongePowered/Mixin#497 FabricMC/Mixin#54
forge version can not launch due to a bug of the dependency. SpongePowered/Mixin#497 FabricMC/Mixin#54
forge version can not launch due to a bug of the dependency. SpongePowered/Mixin#497 FabricMC/Mixin#54
I've been trying to inject code into the lambda in this file, which is quite similar to the My Mixin code is below. @Mixin(value = Mossable.class, remap = false)
public interface MossableMixin {
@Inject(
method = "lambda$static$0",
at = @At(
value = "INVOKE",
target="com/ordana/immersive_weathering/IWPlatformStuff.addExtraMossyBlocks (Lcom/google/common/collect/ImmutableBiMap$Builder;)V"
), locals = LocalCapture.CAPTURE_FAILSOFT, remap = false
)
private static void lambda$static$0(
CallbackInfoReturnable<BiMap<Block, Block>> cir,
ImmutableBiMap.Builder<Block, Block> builder
) {
WeatheringHelper.addOptional(builder, "twigs:cobblestone_bricks", "twigs:mossy_cobblestone_bricks");
}
} On running this code, I get the following error The mixin version I'm using is 0.8.7 on Forge 1.20.1. My compatibility level is Java 17. Someone on the Discord mentioned that this might be a bug, so I decided to put this here. |
Mixin and interfaces is a long story of friendship.
Let's take it from the start and talk about the
Oxidizable
interface in Minecraft 1.17, all names here are from the yarn mappings.All oxidation level increases are done with a supplier of a bimap of blocks, and the level decreases one is simply the inversion of the first.
It looks like that
For any mods which wants to add blocks in this map will find a wall, a big one.
Let's take a look at Java 8 first and the issues:
final
and the JVM won't like that at all.public static
injector (required by interfaces in Java 8)With the recent upgrade to Java 16 we now have access to private methods in interfaces, and I guessed I could finally ditch the ugly raw-asm transformation, but yet it's still impossible due to the fact that mixin yells
tesla_coil.mixins.json:OxidizableMixin: Interface mixin contains a non-public method! Found onBuildLevelIncreasesMap(Lorg/spongepowered/asm/mixin/injection/callback/CallbackInfoReturnable;)V in tesla_coil.mixins.json:OxidizableMixin
So, I cannot use a class mixin, I cannot use a public static injector, nor a private static injector.
(note: even though Java 16 is not yet officially supported, the issue still exist if using Java 11 as the private methods in interfaces are in Java since Java 9)
To conclude, mixin is way too aggressive in its checks globally which impedes its capacities.
The text was updated successfully, but these errors were encountered: