can't run baritone with `:fabric:runClient` with litematica in `run/client/mods` due to conflict between mojmap and malilib method names
tolland opened this issue ยท 10 comments
Some information
Operating system:
Java version: 17.0.11
Minecraft version: 1.20.4
Baritone version: 1.10.2
Other mods (if used): litematica and malilib
Exception, error or logs
Please find your latest.log
or debug.log
in this folder and attach it to the issue
How to reproduce
- Build baritone fabric from a branch, i.e. this one https://github.com/tolland/baritone/tree/1.20.4-bump1
- add litematica (and it's dependency malilib) to the
fabric/run/client/mods
directory - execute gradle :fabric:runClient
Minecraft will run, and baritone is working. however it will crash when litematica menus are interacted with, due to conflict between mojmap methods.
Caused by: java.lang.StackOverflowError
at com.mojang.blaze3d.platform.InputConstants.isKeyDown(InputConstants.java:473) ~[minecraft-1.20.4-fabric-merged+fixed-mojmap+intermediary.jar:?]
at net.minecraft.client.gui.screens.Screen.hasShiftDown(Screen.java:377) ~[minecraft-1.20.4-fabric-merged+fixed-mojmap+intermediary.jar:?]
at fi.dy.masa.malilib.gui.GuiBase.isShiftDown(GuiBase.java:675) ~[malilib-0.18.0-64b5720b4b825f21.jar:?]
at fi.dy.masa.malilib.gui.GuiTextFieldGeneric.setCursorPosition(GuiTextFieldGeneric.java:93) ~[malilib-0.18.0-64b5720b4b825f21.jar:?]
at net.minecraft.client.gui.components.EditBox.moveCursorTo(EditBox.java:256) ~[minecraft-1.20.4-fabric-merged+fixed-mojmap+intermediary.jar:?]
at fi.dy.masa.malilib.gui.GuiTextFieldGeneric.setCursorPosition(GuiTextFieldGeneric.java:93) ~[malilib-0.18.0-64b5720b4b825f21.jar:?]
at net.minecraft.client.gui.components.EditBox.moveCursorTo(EditBox.java:256) ~[minecraft-1.20.4-fabric-merged+fixed-mojmap+intermediary.jar:?]
Final checklist
- I know how to properly use check boxes
- I have included the version of Minecraft I'm running, baritone's version and forge mods (if used).
- I have included logs, exceptions and / or steps to reproduce the issue.
- I have not used any OwO's or UwU's in this issue.
So if I build the baritone mod and run them in a vanilla minecraft deploy, I don't see this error. This seems to occur purely in a dev environment.
this issue appears to be the same one:
maruohon/malilib#149
There is a similar issue here : #4325 with some suggestions, but it's not clear how to implement them if you are not familiar with unimined gradle plugin
It seems like this might be some way to work around the problem:
https://github.com/unimined/unimined/blob/main/testing/1.20.4-NeoForged-Forge-Fabric/build.gradle#L45-L49
Putting this at the bottom of the mappings
block in the root build.gradle
seems to work:
stub.withMappings("official", ["mojmap"]) {
c("exp", []) {
m("e", "(I)V", ["setCursorPositionVanilla"])
}
}
I wouldn't expect to have to use notch names for this, but trying stub.withMappings("intermediary", ["mojmap"])
resulted in unimined complaining about conflicting target names (both exp
and net/minecraft/class_342
mapping to net/minecraft/class_342
) and some other combination made fabric runtime remapping crash.
@tolland it seems like @wagyourtail answered your question in unimined/unimined#74 and fixing name clashes of litematica/malilib with mojmap isn't really in scope for Baritone so I think this issue can be closed?
I'm not sure its completely out of scope, as baritone integrates with litematica (which depends on malilib) via schematic building... and there are a bunch of bugs in the litematica code which are very hard to fix unless you can build baritone together with litematica in intellij
@tolland it seems like @wagyourtail answered your question in unimined/unimined#74 and fixing name clashes of litematica/malilib with mojmap isn't really in scope for Baritone so I think this issue can be closed?
It seems a like a good place to start, but I am unfamiliar with the mappings bit and also with the unimined plugin, so I've not managed to get that working despite some attempts based on the docs provided
Ah ok, it seems that getCursorPosition needs to be fixed as well
at fi.dy.masa.malilib.gui.GuiTextFieldGeneric.getCursorPosition(GuiTextFieldGeneric.java:88) ~[malilib-fabric-1.20.4-0.18.1-mapped-intermediary-1.20.4-mojmap-1.20.4-parchment-2024.04.14-stub-a0f9afd53-mojmap-intermediary.jar:?]
java.lang.StackOverflowError: Unexpected error
at fi.dy.masa.malilib.gui.GuiTextFieldGeneric.getCursorPosition(GuiTextFieldGeneric.java:88)
Maybe try this one:
stub.withMappings("official", ["mojmap"]) {
c("exp", []) {
m("e", "(I)V", ["setCursorPositionVanilla"])
m("e", "()I", ["getCursorPositionVanilla"])
}
}
I made sure it compiles, but didn't test whether it fixes the problem.
I tried that one. It crashes out with an exception...
masa has released a version of malilib and litematica that don't need those methods, so it avoids the crash when running baritone+litematica+malilib, so I think there is a usable work-around.
I tried actually running the game now and after fixing MixinCommandSuggestionHelper
to use the new name (seems like I didn't built everything last time?) the game started successfully and randomly clicking some buttons in the Litematica GUI did not cause a crash.
Anyway, given how common mojmap is I think malilib / litematica fixing the collision is the only proper fix.