FiguraMC / Figura

Extensively customize your character with Figura!
https://modrinth.com/mod/figura
GNU Lesser General Public License v2.1
225 stars 44 forks source link

TaCZ introduces LuaJ as a dependency, causing conflicts #240

Closed 286799714 closed 1 month ago

286799714 commented 1 month ago

Bug Description

I am one of the developer of TaCZ. Due to the need for animation control, we want to introduce LuaJ as a dependency, but this also creates conflicts. We would like to know if there are any techniques to avoid this conflict, or whether the conflict can be resolved through negotiation. here is our Github Repository link

Reproduction Steps

Run Figura together with TaCZ (version 1.0.2 and above), when start up, game crash.

Log File

https://pastebin.com/U63dUdcC

neirenoir commented 1 month ago

I am not in any way affiliated with Figura, but I found a way to make it work with a simple patch. The thing is Figura depends on a forked, better maintained version of luaj, so the JVM does not know which version to use. The most obvious solution would be to use the Figura luaj fork so that there is no conflict even if both are loaded.

In order to do this, we need some changes to build.gradle, and also a new file settings.gradle in the same root directory.

settings.gradle

sourceControl {
    gitRepository(URI.create("https://github.com/FiguraMC/luaj.git")) {
        producesModule("com.github.FiguraMC.luaj:luaj-jse-figura")
    }

    gitRepository(URI.create("https://github.com/FiguraMC/luaj.git")) {
        producesModule("com.github.FiguraMC.luaj:luaj-core-figura")
    }
}

In build.gradle, replace the implementation directives of your luaj packages to:

build.gradle

    implementation(jarJar('com.github.FiguraMC.luaj:luaj-jse:3.0.8-figura')) {
        jarJar.ranged(it, "[3.0.8,)")
    }
    implementation(jarJar('com.github.FiguraMC.luaj:luaj-core:3.0.8-figura')) {
        jarJar.ranged(it, "[3.0.8,)")
    }

The fork is also MIT Licensed, so there should be no issues depending on it without asking.

286799714 commented 1 month ago

I am not in any way affiliated with Figura, but I found a way to make it work with a simple patch. The thing is Figura depends on a forked, better maintained version of luaj, so the JVM does not know which version to use. The most obvious solution would be to use the Figura luaj fork so that there is no conflict even if both are loaded.

In order to do this, we need some changes to build.gradle, and also a new file settings.gradle in the same root directory.

settings.gradle

sourceControl {
    gitRepository(URI.create("https://github.com/FiguraMC/luaj.git")) {
      producesModule("com.github.FiguraMC.luaj:luaj-jse-figura")
    }

    gitRepository(URI.create("https://github.com/FiguraMC/luaj.git")) {
      producesModule("com.github.FiguraMC.luaj:luaj-core-figura")
    }
}

In build.gradle, replace the implementation directives of your luaj packages to:

build.gradle

    implementation(jarJar('com.github.FiguraMC.luaj:luaj-jse:3.0.8-figura')) {
        jarJar.ranged(it, "[3.0.8,)")
    }
    implementation(jarJar('com.github.FiguraMC.luaj:luaj-core:3.0.8-figura')) {
        jarJar.ranged(it, "[3.0.8,)")
    }

The fork is also MIT Licensed, so there should be no issues depending on it without asking.

Yes, use the figura fork can solve the conflict problem, but I noticed that figura made some customizations to their forked, and I'm not sure if this will affect our use. I am wondering is this the only way to solve the problem

neirenoir commented 1 month ago

Now, that's something I cannot answer. However, from what I have seen in one of the issues of the original repo, it required removing Java Micro Edition in order to upgrade to Java 8. The fork was based on Farmboy's fork, which seems to be mostly a cleanup. As far as I can tell, it should work for all of TACZ's purposes. I mean, it's good enough for Figura, so it should also be good enough for TACZ, but then again, I am not a Figura dev.

UnlikePaladin commented 1 month ago

Figura's customizations to LuaJ are just additional cleanup and a few fixes, nothing really "Figura" specific. So it should be safe to use, Figura kinda depends on Lua as a whole and we can't really repackage our fork because it would break every add-on that's been made for figura, so because of Forge's module system you can either use our fork, or continue using the old version you have but you'll have to shadow and relocate which is not ideal either. But those are the only two fixes I'm aware of.

286799714 commented 1 month ago

So it seems that using figura's luaj fork directly is the best choice at present. Thanks for your answers.