Skip to content
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

can't run baritone with :fabric:runClient with litematica in run/client/mods due to conflict between mojmap and malilib method names #4375

Closed
4 tasks done
tolland opened this issue May 29, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@tolland
Copy link

tolland commented May 29, 2024

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

minecraft.log

How to reproduce

  1. Build baritone fabric from a branch, i.e. this one https://github.com/tolland/baritone/tree/1.20.4-bump1
  2. add litematica (and it's dependency malilib) to the fabric/run/client/mods directory
  3. 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.
@tolland tolland added the bug Something isn't working label May 29, 2024
@tolland
Copy link
Author

tolland commented May 29, 2024

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

@ZacSharp
Copy link
Collaborator

ZacSharp commented Jun 2, 2024

@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?

@tolland
Copy link
Author

tolland commented Jun 2, 2024

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
Copy link
Author

tolland commented Jun 2, 2024

@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

@ZacSharp
Copy link
Collaborator

ZacSharp commented Jun 2, 2024

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
Copy link
Author

tolland commented Jun 4, 2024

That's total magic to me. But it does seem to work. Thanks!

@tolland tolland closed this as completed Jun 4, 2024
@tolland
Copy link
Author

tolland commented Jun 4, 2024

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)

@ZacSharp
Copy link
Collaborator

ZacSharp commented Jun 7, 2024

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.

@tolland
Copy link
Author

tolland commented Jun 7, 2024

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.

@ZacSharp
Copy link
Collaborator

ZacSharp commented Jun 8, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants