Giter Club home page Giter Club logo

mixinextras's Introduction

MixinExtras

A small companion library to Mixin, designed to help you write your Mixins in a more expressive and compatible way.

More information about each feature offered can be found at the Wiki.

Setup

MixinExtras is available on Maven Central.

The setup steps vary based on your platform:

Fabric / Quilt

FabricLoader 0.15.0+ includes MixinExtras already. If you want to maintain compatibility with older versions, or want to use a different version than is provided, see below:

dependencies {
    include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:0.3.5")))
}
NeoForge with NeoGradle

NeoForge 20.2.84+ includes MixinExtras already. If you want to maintain compatibility with older versions, or want to use a different version than is provided, see below:

dependencies {
    implementation(jarJar("io.github.llamalad7:mixinextras-neoforge:0.3.5")) {
        jarJar.ranged(it, "[0.3.5,)")
    }
}
Forge 1.18.2+ with ForgeGradle
dependencies {
    compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.3.5"))
    implementation(jarJar("io.github.llamalad7:mixinextras-forge:0.3.5")) {
        jarJar.ranged(it, "[0.3.5,)")
    }
}
Forge 1.18.2+ with Architectury Loom
dependencies {
    compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.3.5"))
    implementation(include("io.github.llamalad7:mixinextras-forge:0.3.5"))
}
Any other platform

This is only a rough guide. You will need to look into the specifics of setting up ShadowJar for your platform.

plugins {
    id "com.github.johnrengelman.shadow" version "8.1.0"
}

configurations {
    implementation.extendsFrom shadow
}

dependencies {
    shadow(annotationProcessor("io.github.llamalad7:mixinextras-common:0.3.5"))
}

shadowJar {
    configurations = [project.configurations.shadow]
    relocate("com.llamalad7.mixinextras", "your.package.goes.here.mixinextras")
    mergeServiceFiles() // Very important!
}

To initialize MixinExtras, simply call

MixinExtrasBootstrap.init();

somewhere suitably early. In almost all cases I would recommend making an IMixinConfigPlugin and initializing MixinExtras in its onLoad method.

You're good to go!

Enjoy using the library, and don't hesitate to open an issue if you have any feedback, questions or suggestions.

Acknowledgements

I use YourKit's Java profiler when working on MixinExtras. Many thanks to them for providing a free license for the project.

mixinextras's People

Contributors

benonardo avatar llamalad7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mixinextras's Issues

[Suggestion] @ModifyVariables

What it does
Like a @ModifyArgs is for multiple @ModifyArgs, a @ModifyVariables should be for multiple @ModifyVariables. Quite simple (unless you need to do hacks with the LVT) and should probably be in mixin, but this is the next best thing.

Why it's a good idea
You often need to modify parts of a vector of color that have been split up into multiple locals, and it's annoying to have to write three of them (even if they are similar).

@Local causes weird log spam when used a a specific way

Log: https://mclo.gs/LcRO1u3

Class: https://github.com/Layers-of-Railways/Railway/blob/e40ef63f1a723f3dd48045991b51f5b3b8cadb98/common/src/main/java/com/railwayteam/railways/mixin/MixinTrackPlacement.java

That exact class's @Local somehow causes mixin/mixin extras to complain about it, as soon as i comment that mixin out theres no errors, not sure whats exactly going on so any help would be appreciated, (or it being fixed if it isnt a fault on my side)

[Suggestion] Adding parameters

Multiple times now, I wanted to add a new parameter to a method or also pass it to a new object (which can be done by adding a setter method, but being able to add parameters to a constructor would be nicer and also allow usage of that parameter in other functionality of the constructor). Currently, the only other way to achieve this is a ThreadLocal and the target methods needs to be invoked in a try...finally statement.

I am not sure how well this can be implemented within the Mixin system, since it requires changing other methods, but it might be similar to @WrapOperation.
I came up with the following syntax, where new parameters are passed as @Share variables:

class MyClass {
    public void method(boolean a) {
        <Some code>
    }
}

@Mixin(MyClass.class)
abstract class MyClassMixin {

    @AddParameters(
        target="method(Z)V
    )
    public abstract void methodWithInt(boolean a, @Share("myInt") int b) //By using int here, the user doesn't need to create a new LocalIntRef object themself
    
    @Inject(
        target="method(Z)V",
        at=<Somewhere>
    )
    void useNewMethodParameter(boolean a, CallbackInfo ci, @Share("myInt") LocalIntRef b) {
        <Some code>
    }
}

(If the target class isn't an interface and the new method should be callable from somewhere else as well, the Mixin needs to be implement an interface with that method, since afaik changing the Mixin to be an interface wouldn't allow injectors and the new paramater can't be referenced from other Mixins)

This would change MyClass in the following way:

class MyClass {
    public void method(boolean a) {
-      <Some code>
+      generatedName(a, 0);
    }
+   public void methodWithInt(boolean a, int b) {
+       generatedName(a, b);
+   }
+   private void generatedName(boolean a, int b) {
+       //Initialize @Share("myInt")
+      <Some code with an injection>
+   }
+   //Injection handler for useNewMethodParameter
}

This would also work when multiple mods add parameters to the same method. However, because of the use of @Share, the added parameters can't be used in other Mixins. Doing the same with constructors would require some extra code and I think the added overload would need to be static and return the created object, since the constructor can't be called otherwise.

Pulling the code from method to generatedName would need to happen after all other injectors (similar to @WrapOperation).

[Question] Why does MixinExtras 0.2.0 for fabric platform requires fabric loader `>=0.14.11`

MixinExtras declares dependency on fabric loader >=0.14.11, but I don't see any actual code dependency on fabric loader >=0.14.11

"depends": {
"fabricloader": ">=0.14.11"
},

The reason why I can't just update my fabric loader is, I have some fabric client setups in mc1.15 and below, that cannot work with fabric loader >=0.12.0. I'm also maintaining some mods for those mc versions. If MixinExtras requires fabric loader >=0.14.11, then I cannot use MixinExtras 0.2.0 for my mods while still support those client setups

If it's not necessary, I'll suggest to remove this dependency, just like the MixinExtras 0.1.1 that depends on nothing

Crash issue

Hey, so I have an issue which I start my instance in MultiMC. Its OK until here right, then it crashes. I was looking through the crash logs for something like 1.5 hours trying to understand what is going on because every time I try to start the instance, the reason seems to change. It connects to almost half of my mods, though only thing that does not change is you and your package com.llamalad7.mixinextras. I need some help and i would really appreciate it if you would.

Here are my logs:

MultiMC version: 0.7.0-3775


Launched instance in online mode

authserver.mojang.com resolves to:
    [13.32.110.84, 13.32.110.119, 13.32.110.82, 13.32.110.97]

session.minecraft.net resolves to:
    [13.107.213.45, 13.107.246.45]

textures.minecraft.net resolves to:
    [13.107.213.45, 13.107.246.45]

api.mojang.com resolves to:
    [13.107.246.45, 13.107.213.45]


Minecraft folder is:
C:/Users/omerz/OneDrive/Masaüstü/MultiMC/instances/1.18.2/.minecraft


Java path is:
C:/Program Files/Java/jdk-20/bin/javaw.exe


Checking Java version...
Java is version 20.0.1, using 64-bit architecture, from Oracle Corporation.


Main Class:
  io.github.zekerzhayard.forgewrapper.installer.Main

Native path:
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/instances/1.18.2/natives

Traits:
traits FirstThreadOnMacOS
traits XR:Initial

Libraries:
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/lwjgl/lwjgl-glfw/3.2.2/lwjgl-glfw-3.2.2.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/lwjgl/lwjgl-jemalloc/3.2.2/lwjgl-jemalloc-3.2.2.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/lwjgl/lwjgl-openal/3.2.2/lwjgl-openal-3.2.2.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/lwjgl/lwjgl-opengl/3.2.2/lwjgl-opengl-3.2.2.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/lwjgl/lwjgl-stb/3.2.2/lwjgl-stb-3.2.2.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/lwjgl/lwjgl-tinyfd/3.2.2/lwjgl-tinyfd-3.2.2.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/lwjgl/lwjgl/3.2.2/lwjgl-3.2.2.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/com/mojang/logging/1.0.0/logging-1.0.0.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/com/mojang/blocklist/1.0.10/blocklist-1.0.10.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/com/mojang/patchy/2.2.10/patchy-2.2.10.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/com/github/oshi/oshi-core/5.8.5/oshi-core-5.8.5.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/net/java/dev/jna/jna/5.10.0/jna-5.10.0.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/net/java/dev/jna/jna-platform/5.10.0/jna-platform-5.10.0.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/slf4j/slf4j-api/1.8.0-beta4/slf4j-api-1.8.0-beta4.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/apache/logging/log4j/log4j-slf4j18-impl/2.17.0/log4j-slf4j18-impl-2.17.0.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/com/ibm/icu/icu4j/70.1/icu4j-70.1.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/com/mojang/javabridge/1.2.24/javabridge-1.2.24.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/net/sf/jopt-simple/jopt-simple/5.0.4/jopt-simple-5.0.4.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/io/netty/netty-all/4.1.68.Final/netty-all-4.1.68.Final.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/com/google/guava/guava/31.0.1-jre/guava-31.0.1-jre.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/apache/commons/commons-lang3/3.12.0/commons-lang3-3.12.0.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/commons-codec/commons-codec/1.15/commons-codec-1.15.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/com/mojang/brigadier/1.0.18/brigadier-1.0.18.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/com/mojang/datafixerupper/4.1.27/datafixerupper-4.1.27.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/com/google/code/gson/gson/2.8.9/gson-2.8.9.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/com/mojang/authlib/3.3.39/authlib-3.3.39.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/apache/commons/commons-compress/1.21/commons-compress-1.21.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/commons-logging/commons-logging/1.2/commons-logging-1.2.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/apache/httpcomponents/httpcore/4.4.14/httpcore-4.4.14.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/it/unimi/dsi/fastutil/8.5.6/fastutil-8.5.6.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/apache/logging/log4j/log4j-api/2.17.0/log4j-api-2.17.0.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/apache/logging/log4j/log4j-core/2.17.0/log4j-core-2.17.0.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/com/mojang/text2speech/1.12.4/text2speech-1.12.4.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/io/github/zekerzhayard/ForgeWrapper/mmc3/ForgeWrapper-mmc3.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/cpw/mods/securejarhandler/1.0.8/securejarhandler-1.0.8.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/ow2/asm/asm/9.5/asm-9.5.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/ow2/asm/asm-commons/9.5/asm-commons-9.5.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/ow2/asm/asm-tree/9.5/asm-tree-9.5.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/ow2/asm/asm-util/9.5/asm-util-9.5.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/ow2/asm/asm-analysis/9.5/asm-analysis-9.5.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/net/minecraftforge/accesstransformers/8.0.4/accesstransformers-8.0.4.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/antlr/antlr4-runtime/4.9.1/antlr4-runtime-4.9.1.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/net/minecraftforge/eventbus/5.0.3/eventbus-5.0.3.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/net/minecraftforge/forgespi/4.0.15-4.x/forgespi-4.0.15-4.x.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/net/minecraftforge/coremods/5.0.1/coremods-5.0.1.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/cpw/mods/modlauncher/9.1.3/modlauncher-9.1.3.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/net/minecraftforge/unsafe/0.2.0/unsafe-0.2.0.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/com/electronwill/night-config/core/3.6.4/core-3.6.4.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/com/electronwill/night-config/toml/3.6.4/toml-3.6.4.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/apache/maven/maven-artifact/3.6.3/maven-artifact-3.6.3.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/net/jodah/typetools/0.8.3/typetools-0.8.3.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/net/minecrell/terminalconsoleappender/1.2.0/terminalconsoleappender-1.2.0.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/jline/jline-reader/3.12.1/jline-reader-3.12.1.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/jline/jline-terminal/3.12.1/jline-terminal-3.12.1.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/openjdk/nashorn/nashorn-core/15.3/nashorn-core-15.3.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/net/minecraftforge/JarJarSelector/0.3.19/JarJarSelector-0.3.19.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/net/minecraftforge/JarJarMetadata/0.3.19/JarJarMetadata-0.3.19.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/cpw/mods/bootstraplauncher/1.0.0/bootstraplauncher-1.0.0.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/net/minecraftforge/JarJarFileSystems/0.3.19/JarJarFileSystems-0.3.19.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/net/minecraftforge/fmlloader/1.18.2-40.2.9/fmlloader-1.18.2-40.2.9.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/com/mojang/minecraft/1.18.2/minecraft-1.18.2-client.jar

Native libraries:
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/lwjgl/lwjgl-glfw/3.2.2/lwjgl-glfw-3.2.2-natives-windows.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/lwjgl/lwjgl-jemalloc/3.2.2/lwjgl-jemalloc-3.2.2-natives-windows.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/lwjgl/lwjgl-openal/3.2.2/lwjgl-openal-3.2.2-natives-windows.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/lwjgl/lwjgl-opengl/3.2.2/lwjgl-opengl-3.2.2-natives-windows.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/lwjgl/lwjgl-stb/3.2.2/lwjgl-stb-3.2.2-natives-windows.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/lwjgl/lwjgl-tinyfd/3.2.2/lwjgl-tinyfd-3.2.2-natives-windows.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/lwjgl/lwjgl/3.2.2/lwjgl-3.2.2-natives-windows.jar
  C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/com/mojang/text2speech/1.12.4/text2speech-1.12.4-natives-windows.jar

Mods:
  [✔️] additionaladditions-4.0.4.jar
  [✔️] AdvancementPlaques-1.18.2-1.4.5.1.jar
  [✔️] AE2WTLib-11.6.3.jar
  [✔️] AkashicTome-1.5-20.jar
  [✔️] alexsmobs-1.18.6.jar
  [✔️] almostunified-forge-1.18.2-0.3.10.jar
  [✔️] AmbientSounds_FORGE_v5.0.16_mc1.18.2.jar
  [✔️] Annotated-DI-Forge-4.0.3+1.18.2.jar
  [✔️] appliedenergistics2-forge-11.7.4.jar
  [✔️] Applied-Mekanistics-1.2.1.jar
  [✔️] architectury-4.11.93-forge.jar
  [✔️] auto_third_person-forge-1.18.2-2.jar
  [✔️] AutoRegLib-1.7-53.jar
  [✔️] badpackets-forge-0.1.2.jar
  [✔️] balm-3.2.6.jar
  [✔️] beautifiedchatclient-1.18.2-2.2.jar
  [✔️] BetterAnimationsCollection-v3.0.0-1.18.2-Forge.jar
  [✔️] bettercombat-forge-1.6.2+1.18.2.jar
  [✔️] BetterF3-3.0.0-Forge-1.18.2.jar
  [✔️] BetterFurnacesReforged-1.18.2-1.3.2.jar
  [✔️] BetterPingDisplay-1.18.2-1.1.jar
  [✔️] Boat-Item-View-Forge-1.18-0.0.3.jar
  [✔️] Bookshelf-Forge-1.18.2-13.3.56.jar
  [✔️] Botania-1.18.2-435.jar
  [✔️] bwncr-3.13.21.jar
  [✔️] caelus-forge-1.18.1-3.0.0.2.jar
  [✔️] carryon-1.18.2-1.17.1.12.jar
  [✔️] citadel-1.11.3-1.18.2.jar
  [✔️] clienttweaks-forge-1.18.1-7.1.0.jar
  [✔️] cloth-config-6.3.81-forge.jar
  [✔️] Clumps-forge-1.18.2-8.0.0+17.jar
  [✔️] cofh_core-1.18.2-9.2.1.39.jar
  [✔️] collective-1.18.2-6.62.jar
  [✔️] compacthelpcommand-1.18.2-2.3.jar
  [✔️] compressedcreativity-1.18.2-0.1.7.jar
  [✔️] connectedness-1.18.2-2.0.1a.jar
  [✔️] Controlling-forge-1.18.2-9.0+23.jar
  [✔️] CooperativeAdvancements-1.18.2-forge-1.3.0.jar
  [✔️] craftingtweaks-forge-1.18.2-14.0.7.jar
  [✔️] create_central_kitchen-1.18.2-for-create-0.5.1.b-1.3.7.d.jar
  [✔️] create_crystal_clear-0.1.1c.jar
  [✔️] create_enchantment_industry-1.18.2-for-create-0.5.1.b-1.2.5.jar
  [✔️] create_jetpack-1.5.1.jar
  [✔️] create-1.18.2-0.5.1.c.jar
  [✔️] createaddition-1.18.2-20230527a.jar
  [✔️] createappliedkinetics-1.3.jar
  [✔️] createoreexcavation-1.1.1.jar
  [✔️] CreativeCore_FORGE_v2.6.17_mc1.18.2.jar
  [✔️] cryingportals-1.18.2-2.3.jar
  [✔️] CTM-1.18.2-1.1.5+5.jar
  [✔️] ctov-2.9.4.jar
  [✔️] curios-forge-1.18.2-5.0.9.1.jar
  [✔️] curiouselytra-forge-1.18.1-5.0.1.0.jar
  [✔️] darkness-forge-mc118-2.0.91.jar
  [✔️] debugify-1.11.0-forge-1.18.2.jar
  [✔️] DiagonalFences-v3.2.2-1.18.2-Forge.jar
  [✔️] Ding-1.18.2-Forge-1.4.1.jar
  [✔️] doubledoors-1.18.2-5.0.jar
  [✔️] durabilitytooltip-1.1.4-forge-mc1.18.jar
  [✔️] dynamiccrosshair-5.1+1.18.2-forge.jar
  [✔️] eatinganimation-1.18.2-2.1.1.jar
  [✔️] EditSign-1.18.2-2.3.1.jar
  [✔️] EnchantmentDescriptions-Forge-1.18.2-10.0.12.jar
  [✔️] enchlevel-langpatch-2.1.2.jar
  [✔️] entityculling-forge-1.6.1-mc1.18.2.jar
  [✔️] EquipmentCompare-1.18.1-1.2.12.jar
  [✔️] Essential-forge_1-18-2.jar
  [✔️] eureka-1.1.0-beta.9.jar
  [✔️] expandedstorage-8.3.3+1.18.2-forge.jar
  [✔️] ExtraDisks-1.18.2-2.1.0.jar
  [✔️] ExtremeReactors2-1.18.2-2.0.64.jar
  [✔️] extremesoundmuffler-3.30_forge-1.18.2.jar
  [✔️] fancymenu_forge_2.14.7_MC_1.18.2.jar
  [✔️] FarmersDelight-1.18.2-1.2.0.jar
  [✔️] feature_nbt_deadlock_be_gone_forge-2.0.0+1.18.2.jar
  [✔️] ferritecore-4.2.2-forge.jar
  [✔️] Fireplace-Lib-Forge-7.0.2+1.18.2.jar
  [✔️] ftbbackups2-forge-1.18.2-1.0.19.jar
  [✔️] ftb-library-forge-1802.3.11-build.177.jar
  [✔️] ftb-quests-forge-1802.3.14-build.191.jar
  [✔️] ftb-teams-forge-1802.2.11-build.107.jar
  [✔️] ftb-ultimine-forge-1802.3.3-build.70.jar
  [✔️] GameMenuModOption-1.18-Forge-1.14.2.jar
  [✔️] geckolib-forge-1.18-3.0.57.jar
  [✔️] grassseeds-1.18.2-3.0.jar
  [✔️] Highlighter-1.18.1-1.1.2.jar
  [✔️] iceandfire-2.1.12-1.18.2.jar
  [✔️] Iceberg-1.18.2-forge-1.0.49.jar
  [✔️] idas_forge-1.6.6+1.18.2.jar
  [✔️] immersive_aircraft-0.4.2+1.18.2-forge.jar
  [✔️] immersive_armors-1.5.5+1.18.2-forge.jar
  [✔️] ImmersiveEngineering-1.18.2-8.4.0-161.jar
  [✔️] ImmersivePosts-1.18.2-4.3.0-3.jar
  [✔️] infernal-expansion-1.18.2-2.5.0.jar
  [✔️] infinitetrading-1.18.2-4.0.jar
  [✔️] integrated_api_forge-1.2.7+1.18.2.jar
  [✔️] integrated_stronghold_forge-1.0.0+1.18.2.jar
  [✔️] InventoryProfilesNext-forge-1.18.2-1.10.6.jar
  [✔️] inventorytotem-1.18.2-3.0.jar
  [✔️] item-filters-forge-1802.2.8-build.50.jar
  [✔️] JRFTL-[1.18.1]-1.3.jar
  [✔️] jumpoverfences-forge-1.18.2-1.0.2.jar
  [✔️] konkrete_forge_1.6.1_MC_1.18-1.18.2.jar
  [✔️] kotlinforforge-3.12.0-all.jar
  [✔️] Ksyxis-Forge1.17-1.1.jar
  [✔️] LegendaryTooltips-1.18.2-1.3.1.jar
  [✔️] libIPN-forge-1.18.2-3.0.2.jar
  [✔️] light-overlay-6.0.5-forge.jar
  [✔️] lightspeed-1.18.2-1.0.2.jar
  [✔️] Mantle-1.18.2-1.9.43.jar
  [✔️] Mekanism-1.18.2-10.2.5.465.jar
  [✔️] MekanismAdditions-1.18.2-10.2.5.465.jar
  [✔️] MekanismGenerators-1.18.2-10.2.5.465.jar
  [✔️] MekanismTools-1.18.2-10.2.5.465.jar
  [✔️] memoryleakfix-forge-1.17+-1.1.1.jar
  [✔️] mob-captains-v2.1.2.jar
  [✔️] modelfix-1.8.jar
  [✔️] MoreBows-1.0.12+1.18.x.forge.jar
  [✔️] MouseTweaks-forge-mc1.18-2.22.jar
  [✔️] naturalist-forge-1.1.1-1.18.2.jar
  [✔️] notenoughanimations-forge-1.6.0-mc1.18.2.jar
  [✔️] notenoughcrashes-4.2.0+1.18.2-forge.jar
  [✔️] oculus-mc1.18.2-1.6.4.jar
  [✔️] open-parties-and-claims-forge-1.18.2-0.19.0.jar
  [✔️] Overlord-Forge-3.2.3+1.18.2.jar
  [✔️] packedup-1.0.29-forge-mc1.18.jar
  [✔️] Patchouli-1.18.2-71.1.jar
  [✔️] Paxi-1.18.2-Forge-2.1.1.jar
  [✔️] plasmovoice-forge-1.18-1.2.19.jar
  [✔️] player-animation-lib-forge-1.0.2+1.18.jar
  [✔️] pneumaticcraft-repressurized-1.18.2-3.6.0-19.jar
  [✔️] polymorph-forge-1.18.2-0.48.jar
  [✔️] Prism-1.18.2-1.0.1.jar
  [✔️] ProjectE-1.18.2-PE1.0.1.jar
  [✔️] projecte-integration-1.18.2-5.4.6.jar
  [✔️] ProjectExpansion-1.18.2-1.0.20.jar
  [✔️] PuzzlesLib-v3.4.6-1.18.2-Forge.jar
  [✔️] Quark-3.2-358.jar
  [✔️] raised-forge-1.18.2-1.2.3.jar
  [✔️] rebind_narrator-forge-1.18.2-2.0.0.jar
  [✔️] Reblured-1.18.2-1.2.0.jar
  [✔️] refinedstorage-1.10.5.jar
  [✔️] refinedstorageaddons-0.8.2.jar
  [✔️] reforgium-1.18.2-1.0.12a.jar
  [✔️] Resourcify (1.18.2-forge)-1.1.0.jar
  [✔️] right-click-harvest-3.2.0+1.18.2-forge.jar
  [✔️] RoughlyEnoughItems-8.3.618.jar
  [✔️] RoughlyEnoughProfessions-forge-1.18.2-1.0.2.jar
  [✔️] screenshot-to-clipboard-1.0.9-forge.jar
  [✔️] selene-1.18.2-1.17.9.jar
  [✔️] simplyswords-forge-1.40-1.18.2.jar
  [✔️] sliceanddice-forge-1.2.1.jar
  [✔️] smoothboot(reloaded)-mc1.18.2-0.0.2.jar
  [✔️] spark-1.10.38-forge.jar
  [✔️] spirit-forge-1.18.2-2.1.8.jar
  [✔️] stackrefill-1.18.2-4.0.jar
  [✔️] starlight-1.0.2+forge.546ae87.jar
  [✔️] supermartijn642configlib-1.1.6-forge-mc1.18.jar
  [✔️] supermartijn642corelib-1.1.10-forge-mc1.18.jar
  [✔️] supplementaries-1.18.2-1.5.18.jar
  [✔️] TaxFreeLevels-1.3.5-forge-1.19.jar
  [✔️] TConstruct-1.18.2-3.6.4.113.jar
  [✔️] teamprojecte-1.18.2-1.1.jar
  [✔️] thermal_cultivation-1.18.2-9.2.0.16.jar
  [✔️] thermal_dynamics-1.18.2-9.2.1b.13.jar
  [✔️] thermal_expansion-1.18.2-9.2.0.20.jar
  [✔️] thermal_foundation-1.18.2-9.2.0.46.jar
  [✔️] thermal_innovation-1.18.2-9.2.0.17.jar
  [✔️] thermal_integration-1.18.2-9.2.0.16.jar
  [✔️] thermal_locomotion-1.18.2-9.2.0.13.jar
  [✔️] tlc_forge-1.0.1-R-1.18.2.jar
  [✔️] toolleveling-forge-1.18.2-1.4.5.jar
  [✔️] ToolSwap-1.18.2-3.1.5.jar
  [✔️] trashcans-1.0.18-forge-mc1.18.jar
  [✔️] TravelersTitles-1.18.2-Forge-2.1.1.jar
  [✔️] Unforgiving-Void-Forge-3.1.5+1.18.2.jar
  [✔️] valkyrienskies-118-2.1.0-beta.12.jar
  [✔️] villagernames-1.18.2-5.2.jar
  [✔️] waveycapes-forge-1.3.2-mc1.18.2.jar
  [✔️] waystone_towers-1.18.2-FORGE-1.0.8.jar
  [✔️] waystones-forge-1.18.2-10.2.1.jar
  [✔️] weaponmaster-1-18-x-multi.jar
  [✔️] wthit-forge-4.13.6.jar
  [✔️] Xaeros_Minimap_23.5.0_Forge_1.18.2.jar
  [✔️] XaerosWorldMap_1.30.6_Forge_1.18.2.jar
  [✔️] YungsApi-1.18.2-Forge-2.2.9.jar
  [✔️] YungsBetterMineshafts-1.18.2-Forge-2.2.jar
  [✔️] YungsBetterNetherFortresses-1.18.2-Forge-1.0.0.jar
  [✔️] YungsBridges-1.18.2-Forge-2.1.0.jar
  [✔️] ZeroCore2-1.18.2-2.1.35.jar

Params:
  --username Tr4fo --version 1.18.2 --gameDir C:/Users/omerz/OneDrive/Masaüstü/MultiMC/instances/1.18.2/.minecraft --assetsDir C:/Users/omerz/OneDrive/Masaüstü/MultiMC/assets --assetIndex 1.18 --uuid <PROFILE ID> --accessToken <ACCESS TOKEN> --userType msa --versionType release --launchTarget forgeclient --fml.forgeVersion 40.2.9 --fml.mcVersion 1.18.2 --fml.forgeGroup net.minecraftforge --fml.mcpVersion 20220404.173914

Window size: 854 x 480

Java Arguments:
[-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump, -Xms5120m, -Xmx10240m, -Duser.language=en]


Minecraft process ID: 11108


Using onesix launcher.

Checking: MC_SLIM
Checking: MERGED_MAPPINGS
Checking: MAPPINGS
Checking: MC_EXTRA
Checking: MOJMAPS
Checking: PATCHED
Checking: MC_SRG
2023-07-09 00:27:29,471 main WARN Advanced terminal features are not available in this environment
[00:27:29] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, Tr4fo, --version, 1.18.2, --gameDir, C:/Users/omerz/OneDrive/Masaüstü/MultiMC/instances/1.18.2/.minecraft, --assetsDir, C:/Users/omerz/OneDrive/Masaüstü/MultiMC/assets, --assetIndex, 1.18, --uuid, <PROFILE ID>, --accessToken, ????????, --userType, msa, --versionType, release, --launchTarget, forgeclient, --fml.forgeVersion, 40.2.9, --fml.mcVersion, 1.18.2, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20220404.173914, --width, 854, --height, 480]
[00:27:29] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 9.1.3+9.1.3+main.9b69c82a starting: java version 20.0.1 by Oracle Corporation
[00:27:30] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/C:/Users/omerz/OneDrive/Masaüstü/MultiMC/libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar%2348!/ Service=ModLauncher Env=CLIENT
[00:27:32] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file C:\Users\omerz\OneDrive\Masaüstü\MultiMC\libraries\net\minecraftforge\fmlcore\1.18.2-40.2.9\fmlcore-1.18.2-40.2.9.jar is missing mods.toml file
[00:27:32] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file C:\Users\omerz\OneDrive\Masaüstü\MultiMC\libraries\net\minecraftforge\javafmllanguage\1.18.2-40.2.9\javafmllanguage-1.18.2-40.2.9.jar is missing mods.toml file
[00:27:32] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file C:\Users\omerz\OneDrive\Masaüstü\MultiMC\libraries\net\minecraftforge\lowcodelanguage\1.18.2-40.2.9\lowcodelanguage-1.18.2-40.2.9.jar is missing mods.toml file
[00:27:32] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file C:\Users\omerz\OneDrive\Masaüstü\MultiMC\libraries\net\minecraftforge\mclanguage\1.18.2-40.2.9\mclanguage-1.18.2-40.2.9.jar is missing mods.toml file
[00:27:32] [main/WARN] [ne.mi.ja.se.JarSelector/]: Attempted to select a dependency jar for JarJar which was passed in as source: cloth_config. Using Mod File: C:\Users\omerz\OneDrive\Masaüstü\MultiMC\instances\1.18.2\.minecraft\mods\cloth-config-6.3.81-forge.jar
[00:27:32] [main/INFO] [ne.mi.fm.lo.mo.JarInJarDependencyLocator/]: Found 31 dependencies adding them to mods collection
Failed to start Minecraft:
java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at io.github.zekerzhayard.forgewrapper.installer.Main.main(Main.java:57)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:243)
	at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:278)
	at org.multimc.EntryPoint.listen(EntryPoint.java:143)
	at org.multimc.EntryPoint.main(EntryPoint.java:34)
Caused by: java.lang.module.ResolutionException: Modules MixinExtras.beta._5 and debugify export package com.llamalad7.mixinextras to module supplementaries
	at java.base/java.lang.module.Resolver.resolveFail(Resolver.java:900)
	at java.base/java.lang.module.Resolver.failTwoSuppliers(Resolver.java:814)
	at java.base/java.lang.module.Resolver.checkExportSuppliers(Resolver.java:735)
	at java.base/java.lang.module.Resolver.finish(Resolver.java:380)
	at java.base/java.lang.module.Configuration.<init>(Configuration.java:139)
	at java.base/java.lang.module.Configuration.resolveAndBind(Configuration.java:493)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.ModuleLayerHandler.buildLayer(ModuleLayerHandler.java:70)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.TransformationServicesHandler.buildTransformingClassLoader(TransformationServicesHandler.java:60)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:104)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:77)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23)
	at [email protected]/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	... 8 more
Exiting with -1
Process exited with exit code -1 (0xffffffffffffffff).
Please note that usually neither the exit code, nor its description are enough to diagnose issues!
Always upload the entire log and not just the exit code.
MultiMC: Log upload triggered at: 09 Jul 2023 00:27:51 +0300

Ability to inject super class and inject new constructors

currently I have found mixins really lack in 2 areas: you can't make a class extend another class, and you can't add new constructors to a class. would also be preferable if those features could also do something like interface injection does, though that part should maybe be in a different lib.

@WrapOperation can not recieve arguments from method, thus failing to replace @Redirect in some cases

MixinExtras has been a great improvement to skip all those @Redirect in our mod. Thanks for that!

However, I just noticed that I have a place where I cannot replace @Redirect with @WrapOperation. Consider the following code:

public void outerMethod(ItemStack itemStack, int i) {
 // ...
 innerCall(0, i);
}

For @Redirect, it is possible to get the arguments of outerMethod as well, using a signature like this:

void myMixin(int zero, int i, ItemStack itemStack, int i2)

Unfortunately, @WrapOperation does not have this functionality. And since I needed that ItemStack to get my mixin to work, I need to keep the @Redirect.

It would be nice if this use case could be supported by @WrapOperation as well.

Targeting lambdas does not work with ME's AP

Title entails.

Trying to build the project with the following (example) annotation generates this error from MixinExtras's Annotation Processor.

@WrapOperation(
    method = "lambda$run$6(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Lnet/minecraft/data/CachedOutput;Ljava/util/Map$Entry;)Ljava/util/concurrent/CompletableFuture;",
    at = @At(
        value = "INVOKE",
        target = "java/util/List.isEmpty()Z"
    )
)
D:\dev\git\minecraft\cryptic-mushroom\registry\src\main\java\com\crypticmushroom\minecraft\registry\coremod\mixin\data\TagsProviderMixin.java:44: error: Unable to locate obfuscation mapping for @WrapOperation target lambda$run$6
    @WrapOperation(
    ^

Vanilla Mixin injectors do not have this problem.

Workaround

This issue can be solved in the short term for projects that need it by manually supplying the method target with the expected SRG obfuscation name.

@WrapOperation(
    method = {
        "lambda$run$6(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Lnet/minecraft/data/CachedOutput;Ljava/util/Map$Entry;)Ljava/util/concurrent/CompletableFuture;",
        "m_252638_(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Lnet/minecraft/data/CachedOutput;Ljava/util/Map$Entry;)Ljava/util/concurrent/CompletableFuture;"
    },
    remap = false,
    at = @At(
        value = "INVOKE",
        target = "java/util/List.isEmpty()Z"
    )
)

Quick Thanks

MixinExtras has been nothing but a blessing for me in many scenarios, and I personally thank you and admire the work you've put into this project.

[Suggestion] Wrap multiple lines with condition

Wraping a code block with an if-statement is fairly easy with ASM, for example:

    private static class MVrenderHand extends MethodVisitor {

        private Label label;

        public MVrenderHand(MethodVisitor mv) {
            super(Opcodes.ASM4, mv);
            label = new Label();
        }

        @Override
        public void visitMethodInsn(int opcode, String owner, String name, String desc) {
            // Wraps the code from GL11.glPushMatrix() to GL11.glPopMatrix() in an if(!Shaders.isHandRendered) check
            if (Names.equals("org/lwjgl/opengl/GL11", "glPushMatrix", "()V", owner, name, desc)) {
                mv.visitFieldInsn(
                        Opcodes.GETSTATIC,
                        "com/gtnewhorizons/angelica/client/Shaders",
                        "isHandRendered",
                        "Z");
                mv.visitJumpInsn(Opcodes.IFNE, label);
                mv.visitMethodInsn(opcode, owner, name, desc);
                return;
            } else if (Names.equals("org/lwjgl/opengl/GL11", "glPopMatrix", "()V", owner, name, desc)) {
                mv.visitMethodInsn(opcode, owner, name, desc);
                mv.visitLabel(label);
                mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
                return;
            }
            mv.visitMethodInsn(opcode, owner, name, desc);
        }
    }

It would be nice, if either @WrapWithCondition would be expanded to allow this or a seperate annotation would be implemented.

Ability to modify a `throw` statement.

throw statements should possibly be supported in @WrapWithCondition, and maybe in a separate replace-style injector too.
Possibly a dedicated injection point, or maybe just expect people to use INVOKE targeting <init> on the exception with a shift of AFTER?

Massive lag caused by MixinExtras

So I was experiencing massive lag and I run spark profiler to find out what was causing the lag and I saw this:
lag
the mod is not even in my mods folder but still eating the most server thread, I am running Better MC fabric modpack,

[Suggestion] Skipping execution if possible in ModifyExpressionValue

In a regular Java conditional, if you do something like this:

if (cheapCheck() && expensiveCheck())

expensiveCheck() will only run if cheapCheck() evaluates to true (and with || only if false).

However, with ModifyExpressionValue, as specified in the wiki, an injector like this turns into the following:

    @ModifyExpressionValue(method = "someMethod", at = @At(
            value = "INVOKE",
            target =  "LFoo;expensiveCheck(LParameters;)Z"
    ))
    private boolean cancelIfPossible(boolean original)
    {
        return cheapCheck() && original;
    }
if (cancelIfPossible(expensiveCheck()))

This forces expensiveCheck() to run every time, given it is passed as a parameter and therefore can't ever be skipped (unless it has no side effects or something, I'm not an expert on this).

Would it be possible for MixinExtras to inline those in order to allow such checks to be skipped? (note that I have no idea if this is actually possible or feasible, just asking) Or would it cause the same incompatibilities as Redirect?

An equivalent Redirect that would do the job would be something like this:

    @Redirect(method = "someMethod", at = @At(
            value = "INVOKE",
            target =  "LFoo;expensiveCheck(LParameters;)Z"
    ))
    private boolean cancelIfPossible(Foo object, Parameters params)
    {
        return cheapCheck() && object.expensiveCheck(params);
    }

[0.2.0-beta-5] Forge/Quilt launch failure for 1.19.3 Architectury

Using

Architectury Forge/Fabric/Quilt 1.19.3

Gradle

build.gradle (quilt) - same as fabric

shadowImplementation(annotationProcessor("com.github.llamalad7.mixinextras:mixinextras-fabric:${rootProject.mixinextras_version}")) { transitive false }

build.gradle (forge)

implementation(annotationProcessor("com.github.llamalad7.mixinextras:mixinextras-common:${rootProject.mixinextras_version}"))
implementation(include("com.github.llamalad7.mixinextras:mixinextras-forge:${rootProject.mixinextras_version}"))

build.gradle (common)

implementation(annotationProcessor("com.github.llamalad7.mixinextras:mixinextras-common:${rootProject.mixinextras_version}"))

Expected

Forge, Fabric, Quilt runs fine.

Result

Quilt and Forge does not launch.

Quilt error

Dependency for mod 'com_github_llamalad7_mixinextras' on fabricloader versions [>=0.14.11] (0 valid options, 1 invalid options)
	x provided mod 'fabricloader' version '0.14.10' from mod 'quilt_loader' version 0.17.7 loaded from /Users/kristof/Artemis/.gradle/loom-cache/remapped_mods/loom_mappings_1_19_3_layered_hash_955958575_v2_arch_quilt/org/quiltmc/quilt-loader/0.17.7/quilt-loader-0.17.7.jar
	at org.quiltmc.loader.impl.QuiltLoaderImpl.load(QuiltLoaderImpl.java:214) ~[quilt-loader-0.17.7.jar:?]
	at org.quiltmc.loader.impl.launch.knot.Knot.init(Knot.java:141) ~[quilt-loader-0.17.7.jar:?]
	at org.quiltmc.loader.impl.launch.knot.Knot.launch(Knot.java:70) ~[quilt-loader-0.17.7.jar:?]
	at org.quiltmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:24) ~[quilt-loader-0.17.7.jar:?]
	at net.fabricmc.devlaunchinjector.Main.main(Main.java:86) ~[dev-launch-injector-0.2.1+build.8.jar:?]
	at dev.architectury.transformer.TransformerRuntime.main(TransformerRuntime.java:217) ~[architectury-transformer-5.2.72-runtime.jar:5.2.72]

Forge error

[08:31:18] [main/ERROR] (JarInJarDependencyLocator) Failed to load mod file META-INF/jars/MixinExtras-0.2.0-beta.5.jar from mixinextras-forge-0.2.0-beta.5.jar
Exception in thread "main" net.minecraftforge.forgespi.locating.ModFileLoadingException: Failed to load mod file mixinextras-forge-0.2.0-beta.5.jar
	at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.moddiscovery.JarInJarDependencyLocator.loadModFileFrom(JarInJarDependencyLocator.java:89)
	at MC-BOOTSTRAP/[email protected]/net.minecraftforge.jarjar.selection.JarSelector.recursivelyDetectContainedJars(JarSelector.java:144)
	at MC-BOOTSTRAP/[email protected]/net.minecraftforge.jarjar.selection.JarSelector.detect(JarSelector.java:122)
	at MC-BOOTSTRAP/[email protected]/net.minecraftforge.jarjar.selection.JarSelector.detectAndSelect(JarSelector.java:33)
	at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.moddiscovery.JarInJarDependencyLocator.scanMods(JarInJarDependencyLocator.java:49)
	at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer.discoverMods(ModDiscoverer.java:127)
	at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.FMLLoader.beginModScan(FMLLoader.java:166)
	at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.FMLServiceProvider.beginScanning(FMLServiceProvider.java:86)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.TransformationServiceDecorator.runScan(TransformationServiceDecorator.java:112)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.TransformationServicesHandler.lambda$runScanningTransformationServices$8(TransformationServicesHandler.java:100)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1779)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
	at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
	at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
	at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622)
	at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.TransformationServicesHandler.runScanningTransformationServices(TransformationServicesHandler.java:102)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.TransformationServicesHandler.initializeTransformationServices(TransformationServicesHandler.java:55)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:87)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:77)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23)
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141)
	at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)
	at dev.architectury.transformer.TransformerRuntime.main(TransformerRuntime.java:217)
Caused by: java.lang.IllegalArgumentException: Out of range 1 to 1 for length 1
	at [email protected]/net.minecraftforge.jarjar.nio.pathfs.PathPath.subpath(PathPath.java:97)
	at [email protected]/net.minecraftforge.jarjar.nio.pathfs.PathPath.relativize(PathPath.java:186)
	at [email protected]/net.minecraftforge.jarjar.nio.pathfs.PathFileSystem.getOuterTarget(PathFileSystem.java:152)
	at [email protected]/net.minecraftforge.jarjar.nio.pathfs.PathFileSystem.checkAccess(PathFileSystem.java:225)
	at [email protected]/net.minecraftforge.jarjar.nio.pathfs.PathFileSystemProvider.checkAccess(PathFileSystemProvider.java:180)
	at java.base/java.nio.file.Files.exists(Files.java:2527)
	at cpw.mods.securejarhandler/cpw.mods.jarhandling.impl.Jar.lambda$new$3(Jar.java:80)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
	at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
	at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
	at cpw.mods.securejarhandler/cpw.mods.jarhandling.impl.Jar.<init>(Jar.java:80)
	at cpw.mods.securejarhandler/cpw.mods.jarhandling.SecureJar.from(SecureJar.java:70)
	at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.moddiscovery.AbstractModProvider.createMod(AbstractModProvider.java:38)
	at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.moddiscovery.JarInJarDependencyLocator.loadModFileFrom(JarInJarDependencyLocator.java:84)
	... 27 more

java.lang.NoClassDefFoundError: com/llamalad7/mixinextras/MixinExtrasBootstrap when using a Lib that jarJars MixinExtra

I got a dependency that uses MixinExtras and when i try to start runClient i'll get this Log:

[19:56:46] [main/DEBUG] [mixin/]: Selecting config mixinextras.init.mixins.json
Exception in thread "main" java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/llamalad7/mixinextras/MixinExtrasBootstrap
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:32)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:108)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:78)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23)
	at [email protected]/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141)
Caused by: java.lang.NoClassDefFoundError: com/llamalad7/mixinextras/MixinExtrasBootstrap
	at TRANSFORMER/[email protected]/com.llamalad7.mixinextras.platform.forge.MixinExtrasConfigPlugin.onLoad(MixinExtrasConfigPlugin.java:14)
	at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.PluginHandle.onLoad(PluginHandle.java:119)
	at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinConfig.onSelect(MixinConfig.java:707)
	at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.selectConfigs(MixinProcessor.java:498)
	at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.select(MixinProcessor.java:460)
	at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.checkSelect(MixinProcessor.java:438)
	at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:290)
	at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClass(MixinTransformer.java:250)
	at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.service.modlauncher.MixinTransformationHandler.processClass(MixinTransformationHandler.java:131)
	at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.launch.MixinLaunchPluginLegacy.processClass(MixinLaunchPluginLegacy.java:131)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.serviceapi.ILaunchPluginService.processClassWithFlags(ILaunchPluginService.java:156)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:88)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:120)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.TransformingClassLoader.maybeTransformClassBytes(TransformingClassLoader.java:50)
	at cpw.mods.securejarhandler/cpw.mods.cl.ModuleClassLoader.readerToClass(ModuleClassLoader.java:113)
	at cpw.mods.securejarhandler/cpw.mods.cl.ModuleClassLoader.lambda$findClass$15(ModuleClassLoader.java:219)
	at cpw.mods.securejarhandler/cpw.mods.cl.ModuleClassLoader.loadFromModule(ModuleClassLoader.java:229)
	at cpw.mods.securejarhandler/cpw.mods.cl.ModuleClassLoader.findClass(ModuleClassLoader.java:219)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:637)
	at java.base/java.lang.Class.forName(Class.java:545)
	at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:25)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30)
	... 7 more
Caused by: java.lang.ClassNotFoundException: com.llamalad7.mixinextras.MixinExtrasBootstrap
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
	at cpw.mods.securejarhandler/cpw.mods.cl.ModuleClassLoader.loadClass(ModuleClassLoader.java:137)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
	at cpw.mods.securejarhandler/cpw.mods.cl.ModuleClassLoader.loadClass(ModuleClassLoader.java:137)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
	... 29 more

i'm on 1.19.2 Forge

@WrapOperation on instantiation causes an ArrayIndexOutOfBoundsException

Hi,
i am trying to use @WrapOperation to wrap an instantiation but im having some trouble getting it to work:

My working Redirect:

    @Redirect(
            method = "startIntegratedServer(Ljava/lang/String;Lnet/minecraft/util/registry/RegistryTracker$Modifiable;Ljava/util/function/Function;Lcom/mojang/datafixers/util/Function4;ZLnet/minecraft/client/MinecraftClient$WorldLoadAction;)V",
            at = @At(
                    value = "NEW",
                    target = "Lnet/minecraft/util/UserCache;"
            )
    )
    private UserCache wrapUserCache(GameProfileRepository profileRepository, File cacheFile) {
        if (...) {
            return ...;
        }
        return new UserCache(profileRepository, cacheFile);
    }

My non-working attempt at a WrapOperation:

    @WrapOperation(
            method = "startIntegratedServer(Ljava/lang/String;Lnet/minecraft/util/registry/RegistryTracker$Modifiable;Ljava/util/function/Function;Lcom/mojang/datafixers/util/Function4;ZLnet/minecraft/client/MinecraftClient$WorldLoadAction;)V",
            at = @At(
                    value = "NEW",
                    target = "Lnet/minecraft/util/UserCache;"
            )
    )
    private UserCache wrapUserCache(GameProfileRepository profileRepository, File cacheFile, Operation<UserCache> original) {
        if (...) {
            return ...;
        }
        return original.call(profileRepository, cacheFile);
    }

I am using Fabricloader 0.15.1 with MixinExtras 0.3.1. (The log confirms that MixinExtras 0.3.1 is in fact loading correctly).
Minecraft version is 1.16.1 using Java 17.
The MinecraftDev plugin unfortunately isnt of much help because it doesnt recognize the injector correctly on the Redirect either.

Minecraft crashes with java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0, the full crash as a text file can be found here.

Missing classes at runtime with forgegradle

Hello,
I am sure I am doing something dumb, but I am having trouble getting Mixinextras setup in forge gradle. Ive used normal implementation, implementation with fg.deobf, and shade extending implementation. Unfortunately with all of these, the jar files are missing at runtime, particularly the MixinExtrasBootstrap.init() during the mixinPlugin load, as well as mod constructor.

My branch for adding this project is here: https://github.com/baileyholl/Ars-Nouveau/pull/664/files
Does anything look particularly out of place here?

Thank you!

Spark shows MixinExtras causing MSPT hits

My server for AQM2 (same modpack as my last issue) is having consistent lag spikes more than normal since Repurposed Structures updated to Beta 6. Now I am not accusing MixinExtras but going off the profiler, it shows MixinExtras as the mod that is behind the most in ticks.

https://spark.lucko.me/b3079MC5NE (Ran w/ --only-ticks-over 200) so 5 ticks here occurred and this is what represents that.
image
image

--

Also when a player joins, server lags for about 20 seconds roughly. -- https://spark.lucko.me/cITj7f8U5g?hl=290

Java 8+

Is it possible to make this compatible with java 8+

I currently cannot use this because I get the following error:

gamebuster@gamebuster-Ryzen9-3900X-RTX-3080:~/Desktop/Modding/WildermythGameProvider$ ./gradlew build --info
Initialized native services in: /home/gamebuster/.gradle/native
The client will now receive all logging from the daemon (pid: 1159260). The daemon log file: /home/gamebuster/.gradle/daemon/7.1.1/daemon-1159260.out.log
Starting 24th build in daemon [uptime: 57 mins 53.899 secs, performance: 99%, non-heap usage: 51% of 256 MiB]
Using 24 worker leases.
Now considering [/home/gamebuster/Desktop/Modding/WildermythGameProvider] as hierarchies to watch
Watching the file system is enabled if available
Starting Build
Settings evaluated using settings file '/home/gamebuster/Desktop/Modding/WildermythGameProvider/settings.gradle'.
Projects loaded. Root project using build file '/home/gamebuster/Desktop/Modding/WildermythGameProvider/build.gradle'.
Included projects: [root project 'WildermythGameProvider']

> Configure project :
Evaluating root project 'WildermythGameProvider' using build file '/home/gamebuster/Desktop/Modding/WildermythGameProvider/build.gradle'.
All projects evaluated.
Selected primary task 'build' from project :
Populating VCS workingDir MixinExtra_ekvol5eg59rv8qezjbdvgjak4/MixinExtras with ref 0.0.6: c948689427146f57d5bfb80eedc6efd62bdbcb7d
Now considering [/home/gamebuster/Desktop/Modding/WildermythGameProvider/.gradle/vcs-1/MixinExtra_ekvol5eg59rv8qezjbdvgjak4/MixinExtras, /home/gamebuster/Desktop/Modding/WildermythGameProvider] as hierarchies to watch

> Configure project :MixinExtras
Evaluating project ':MixinExtras' using build file '/home/gamebuster/Desktop/Modding/WildermythGameProvider/.gradle/vcs-1/MixinExtra_ekvol5eg59rv8qezjbdvgjak4/MixinExtras/build.gradle.kts'.
Caching disabled for Kotlin DSL accessors for project ':MixinExtras' because:
  Build cache is disabled
Skipping Kotlin DSL accessors for project ':MixinExtras' as it is up-to-date.
Registering project ':MixinExtras' in composite build. Will substitute for module 'com.llamalad7:MixinExtras'.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':compileJava'.
> Could not resolve all task dependencies for configuration ':compileClasspath'.
   > Could not resolve com.llamalad7:MixinExtras:0.0.6.
     Required by:
         project :
      > No matching variant of project :MixinExtras was found. The consumer was configured to find an API of a library compatible with Java 9, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally but:
          - Variant 'apiElements' capability com.llamalad7:MixinExtras:0.0.6 declares an API of a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component compatible with Java 16 and the consumer needed a component compatible with Java 9
              - Other compatible attribute:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
          - Variant 'runtimeElements' capability com.llamalad7:MixinExtras:0.0.6 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component compatible with Java 16 and the consumer needed a component compatible with Java 9
              - Other compatible attribute:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 775ms

I also tried altering the build script myself to make it compatible with java 8, but I don't really know Kotlin, and it didn't work.

Unable to get MixinExtras working on Forge 1.19.4 with Architectury

Problematic Mixin method:

@ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;useFancyGraphics()Z"))
    private boolean forceRenderDamageVignette(boolean vignetteAllowed) {
        LivingEntity entity = (LivingEntity) minecraft.cameraEntity;
        @SuppressWarnings("DataFlowIssue")
        float hpScaled = entity.getHealth() / entity.getMaxHealth() * 100.0f;
        float confLow = Mth.clamp(DamageVignette.configProvider.getLowThreshold(), 0.0f, DamageVignette.configProvider.getHighThreshold());
        float confHigh = Mth.clamp(DamageVignette.configProvider.getHighThreshold(), confLow, 100.0f);
        DamageVignette.curOpacity = (confHigh - hpScaled) / (confHigh - confLow);
        return vignetteAllowed || DamageVignette.configProvider.isModEnabled() && DamageVignette.curOpacity > 0.0f;
    }

Methods from vanilla Mixin work correctly
Adding @Debug(export = true) and looking at the output class file shows the @ModifyExpressionValue being applied, however adding a System.out.println to that method will show that no modification actually happened (nothing will be printed when the method is invoked)

Common build.gradle dependencies block:

dependencies {
    implementation(annotationProcessor("com.github.llamalad7.mixinextras:mixinextras-common:0.2.0-beta.6"))

    // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
    // Do NOT use other classes from fabric loader
    modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
}

Forge build.gradle:

dependencies {
    implementation(include("com.github.llamalad7.mixinextras:mixinextras-forge:0.2.0-beta.6"))

    forge "net.minecraftforge:forge:${rootProject.forge_version}"

    common(project(path: ":common", configuration: "namedElements")) { transitive false }
    shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false }
}

[Suggestion] `@ModifyComparisonArg`

This would wrap the entire left-hand or right-hand side of a comparison, which could be chained by multiple mixins.

Example:

@ModifyComparisonArg(
    method = "targetMethod", 
    comparison = "LESS_THAN_OR_EQUAL",
    argument = "SECOND" //or maybe side = "RIGHT_SIDE"?
)
private TargetType wrapExpression(TargetType expression){
    //TargetType is either int, long, float, double, boolean(?)
    return expression + 5;
}

Code diff:

- if(x * i <= foo.get() * 4){
+ if(x * i <= wrapExpression(foo.get() * 4)){
    // stuff
}

Note: in this example code diff, there is no way to add 5 to either side. If you used a @ModifyExpressionValue on foo.get(), then any value you add gets multiplied by 4 (which will not be the same result). And if you used a @ModifyConstant or @Redirect on the field access, then (in this example) any change you make will also get multiplied by the other values in the expression (again, not the same result), while also not being compatible with any other mixins using the same target.

Docs in javadocs?

It's kind of annoying to have to open up this github page whenever I want to check the syntax of one of your injectors. Copying the docs or at least the most important parts into javadocs would make usage a lot smoother.

[Suggestion] find a way to add a constructor.

It’s possible to add a constructor to a mixined class by using ASM and visiting the method in a MixinPluginConfig postApply.
But you have to write the byte code yourself, I would like to find an easier way to do it.

[Forge] "incompatible modded server" when MixinExtras jar is used only server-side

Forge does a compatibility check in the server list, marking servers as incompatible if the client doesn't have any mod that is required (and mods are marked as required by default):

The server can still be joined and everything will work as expected, though it is an eye sore.

Mods can opt-out of this check via this API call:

ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class,
    () -> new IExtensionPoint.DisplayTest(() -> IExtensionPoint.DisplayTest.IGNORESERVERONLY, (a, b) -> true));

This code is for 1.20.2. Previously (not exactly sure when) the constant was called NetworkConstants.IGNORESERVERONLY.
Sadly the value changed too, breaking binary compatibility, so fixing this would require multiple mixinextras-forge builds.


As a workaround one should be able to remove
implementation(include("io.github.llamalad7:mixinextras-forge:0.2.0-rc.4"))
and add a Mixin plugin with a manual MixinExtrasBootstrap.init(); call.
edit: Nope, one needs to shadow mixinextras-common at least.

LocalRef error can happen when you capture a ref as a lambda parameter

You can get the following error when you capture a localref variable in a lambda or otherwise, such that it is only read after the handler completes:

java.lang.IllegalStateException: Uninitialized LocalRef! This should never happen! Please report to LlamaLad7!

In my case I was messing with executors in resource reload code and accidentally captured it in a lambda that executes on another thread. This is easy to work around on the user side, and I don't see how mixin extras could resonably support using variables later, but it would be nice if the error on a disposed localref would be different from an uninitialized one.

Mostly just reporting because the error is somewhat misleading

Weird Crashing issue that occurs between 1 and 3 minutes after loading singleplayer world.

I am still actively trying to debug this issue but here is my latest.log.

latest.log

The exact issue I am having is here.

com.llamalad7.mixinextras.injector.wrapoperation.IncorrectArgumentCountException: Incorrect number of arguments passed to Operation::call! Expected 2 but got 1. Expected types were [net.minecraft.world.entity.EntityType, net.minecraft.world.level.Level], actual types were [net.minecraft.server.level.ServerLevel].

I'm not directly adding mixin extras but it seems to be being added by geckoLib.

Googling has resulted in absolutely no helpful answers, I am actively combing through my mods trying to figure out what combination causes this.

Forge 43.3.2
Minecraft 1.19.2

Neither mod is directly added:
MixinExtras-0.2.0-rc.4.jar
mixinextras-forge-0.2.0-rc.4.jar

Refmap not working

Automatic generation of refmap during build does not work with MixinExtras annotations

New readme should be present on landing page

If the old readme needs to be kept around, that's one thing, but I got very confused trying to use MixinExtras before someone pointed out that there's a new readme, whose instructions worked like a charm.

JiJ-able fabric mod version

Hi!

Amazing library first of all, looks really useful!

Do you think it'd be a good idea to have a JiJ-able fabric mod (maybe as a sub project/module so the main code doesn't depend on it) so if other mods can directly JiJ it, there's no need to load the same library multiple times in different locations (via shadow) and the initialization is also handled by it? That'd also make it more easily version-able and have a proper entry as a mod.

Just a suggestion that crossed my mind, what do you think?

[Suggestion] be able to use 'Object... args' for @WrapOperation

Hi,

sometimes you just want to wrap the method without really worrying about any of the args, in which case just having the method parameters be Object... args, Operation<?> original could be useful.
I know that this alone doesnt seem like a big benefit but it can allow for more compatibility between different mc versions (where you may want to wrap the same method but it has different args) by using different this + multiple @At's.

Similar would also be useful for @WrapWithCondition (although in that case just having no args would also do the job, especially if you want to wrap multiple @At's with the same condition.

This isn't something super necessary but could be neat for making mods that work for lots of different versions.

WrapOperation - weird crash on Forge 1.20.2 user env

@Mixin(GuiGraphics.class)
public abstract class ForgeGuiGraphicsMixin {
    @WrapOperation(
            method =
                    "renderTooltip(Lnet/minecraft/client/gui/Font;Ljava/util/List;Ljava/util/Optional;Lnet/minecraft/world/item/ItemStack;II)V",
            at =
                    @At(
                            value = "INVOKE",
                            target =
                                    "Lnet/minecraft/client/gui/GuiGraphics;renderTooltip(Lnet/minecraft/client/gui/Font;Ljava/util/List;Ljava/util/Optional;II)V",
                    remap = false),
            remap = false)
    private void renderTooltipPre(
            GuiGraphics instance,
            Font font,
            List<Component> tooltipLines,
            Optional<TooltipComponent> visualTooltipComponent,
            int mouseX,
            int mouseY,
            Operation<Void> operation,
            @Local ItemStack itemStack) {}
}

This mixin fails to apply in user env, but works fine in dev env.. I am not quite sure what I am doing wrong here, I tried experimenting with remap = false/trues..

Using Mixinextra-0.2.0-rc.5.

Crash log: https://gist.github.com/kristofbolyai/60455d83d353fcc72ab4495a63d8eb89

final field accessed via lambda by `@WrapOperation`

Source:
https://github.com/Vivecraft/VivecraftMod/pull/191/files#diff-27b99287eb2f32e8c6825a339b936ebb9e82785501cfcb57774fd418b2dd813a
Production:

    @MixinMerged(
        mixin = "org.vivecraft.mixin.client_vr.OptionsVRMixin",
        priority = 1000,
        sessionId = "9a7dff99-503d-479d-94c9-bc69ee4a339c"
    )
    void wrapOperation$zcn000$vivecraft$processOptionsMixin(class_315 instance, class_304[] keyMappings, Operation original) {
        if (keyMappings != null) {
            if (keyMappings.length > 0) {
                keyMappings = (class_304[])Stream.concat(Arrays.stream(keyMappings), VivecraftVRMod.userKeyBindingSet.stream()).toArray((x$0) -> {
                    return new class_304[x$0];
                });
                VivecraftVRMod.vanillaBindingSet.addAll(Arrays.asList(keyMappings));
                VRSettings.logger.info("keyMappings is: {}", Arrays.toString(keyMappings));
                original.call(new Object[]{instance, keyMappings});
            } else {
                VRSettings.logger.error("keyMappings is empty! {}", Arrays.toString(keyMappings));
                throw new MissingResourceException("keyMappings is empty!", keyMappings.getClass().getName(), Arrays.toString(keyMappings));
            }
        } else {
            VRSettings.logger.error("keyMappings is null!");
            throw new NullPointerException("keyMappings is null!");
        }
    }

Production Mixin:

        class_304[] injectorAllocatedLocal6 = (class_304[])ArrayUtils.addAll(new class_304[]{this.field_1886, this.field_1904, this.field_1894, this.field_1913, this.field_1881, this.field_1849, this.field_1903, this.field_1832, this.field_1867, this.field_1869, this.field_1822, this.field_1890, this.field_1907, this.field_1871, this.field_1845, this.field_26845, this.field_1835, this.field_1824, this.field_1816, this.field_1836, this.field_1906, this.field_1831, this.field_1879, this.field_1874, this.field_1844}, this.field_1852);
        this.wrapOperation$zcn000$vivecraft$processOptionsMixin(this, injectorAllocatedLocal6, (var0) -> {
            WrapOperationRuntime.checkArgumentCount(var0, 2, "[net.minecraft.class_315, net.minecraft.class_304[]]");
            ((class_315)var0[0]).field_1839 = (class_304[])var0[1];
            return (Void)null;
        });

Error:

java.lang.IllegalAccessError: Update to non-static final field net.minecraft.class_315.field_1839 attempted from a different method (mixinextras$bridge$field_1839$213) than the initializer method <init> 
	at net.minecraft.class_315.mixinextras$bridge$field_1839$213(class_315.java)
	at net.minecraft.class_315.wrapOperation$zck000$vivecraft$processOptionsMixin(class_315.java:2308)
	at net.minecraft.class_315.<init>(class_315.java:892)
	at net.minecraft.class_310.<init>(class_310.java:460)
	at net.minecraft.client.main.Main.main(Main.java:211)
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468)
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)

I was expecting the mixin to be more like:

        class_304[] injectorAllocatedLocal6 = (class_304[])ArrayUtils.addAll(new class_304[]{this.field_1886, this.field_1904, this.field_1894, this.field_1913, this.field_1881, this.field_1849, this.field_1903, this.field_1832, this.field_1867, this.field_1869, this.field_1822, this.field_1890, this.field_1907, this.field_1871, this.field_1845, this.field_26845, this.field_1835, this.field_1824, this.field_1816, this.field_1836, this.field_1906, this.field_1831, this.field_1879, this.field_1874, this.field_1844}, this.field_1852);
-        this.wrapOperation$zcn000$vivecraft$processOptionsMixin(this, injectorAllocatedLocal6, (var0) -> {
+        ((class_315)var0[0]).field_1839 = this.wrapOperation$zcn000$vivecraft$processOptionsMixin(this, injectorAllocatedLocal6, (var0) -> {
            WrapOperationRuntime.checkArgumentCount(var0, 2, "[net.minecraft.class_315, net.minecraft.class_304[]]");
-            ((class_315)var0[0]).field_1839 = (class_304[])var0[1];
+            return (class_304[])var0[1];
        });

The example from the wiki keeps the left hand side out of the lambda:

- int number = this.expensiveCalculation(flag);
+ int number = this.bypassExpensiveCalculationIfNecessary(this, flag, args -> {
+         return ((TargetClass) args[0]).expensiveCalculation((Boolean) args[1]);
+ });

add initializing string to mod

New to modding so apologies if its an obvious one. How and where do I put the "MixinExtrasBootstrap.init();" string? The tutorial doesn't say where the file to place it in is at or how it goes in

Insufficient maximum stack size when using @Local

I am porting Sound-Physics to Mixin since its ASM code can't handle newer IC2C anymore. The up-to-date code of my fork is located at here.
When loading my build in actual game environment with mixin.debug set to true, this error throwed:
2023-12-14-5.log.gz
I realized this may cause by MixinBooter not using latest MixinExtra, so I rebuilt it with latest MixinExtra (jar), but end up getting different exceptions (log:2023-12-14-7.log.gz)
Since every failed mixin is using @Local, I assume it's better to report here.

WrapWithCondition is wrapping injects

Hi,

it seems when using wrapwithcondition mixinextras will also wrap any injectors injecting at the statement that is being wrapped if the wrapwithcondition's mixin has a lower priority.
I ran into this issue when using 0.2.0, but I've reproduced it with 0.2.1 in this repo.
It contains three different mixins into MinecraftClient#setScreen:

  • a mixin with default priority = 1000 containing an inject at MinecraftClient#updateWindowTitle
  • a mixin with priority = 500 containing a wrapwithcondition targetting MinecraftClient#updateWindowTitle
  • a mixin with priority = 1500 containing a wrapwithcondition targetting MinecraftClient#updateWindowTitle

When using mixin export, this is the result:

        if (this.wrapWithCondition$zjg000$modid$wrappingUpdateWindowTitleWithCondition_lowerPriority(this)) {
            this.handler$zjf000$modid$injectingInFrontOfUpdateWindowTitle((CallbackInfo)null);
            if (this.wrapWithCondition$zjh000$modid$wrappingUpdateWindowTitleWithCondition_higherPriority(this)) {
                this.updateWindowTitle();
            }
        }

The wrapwithcondition using a higher priority than the inject only wraps the MinecraftClient#updateWindowTitle call, however the wrapwithcondition using a lower priority wraps both the inject and MinecraftClient#updateWindowTitle.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.