baritone
baritone copied to clipboard
1.21.1 - ATM10 - The Undergarden + Silent Gear + Baritone causes crash
Some information
Operating system: Windows 11 Pro (23H2) Java version: Java 8 Update 421 Minecraft version: 1.21.1 Baritone version: baritone-api-neoforge-1.10.2-9-g3b01f129 Other mods (if used): The Undergarden, Silent Gear (+lib) Neoforge version: 21.1.72
Exception, error or logs
I will provide three files, just to be sure. One is with both mods enabled and the other two are with one disabled. crash_silent_undergarden_on.txt crash_silent_off.txt crash_undergarden_off.txt
How to reproduce
Download ATM10 and add Baritone. You will not be able to create world as it always crashes game before it gets a chance. OR Create custom modpack with said mods and add baritone. Same behaviour.
Modified settings
None.
Final checklist
- [x] I know how to properly use check boxes
- [x] I have included the version of Minecraft I'm running, baritone's version and forge mods (if used).
- [x] I have included logs, exceptions and / or steps to reproduce the issue.
- [x] I have not used any OwO's or UwU's in this issue.
I think that this is my first time ever posting an issue, so if I missed something, just let me know. Thank you for making this mod as it saves my time so I can grind less and spend more time with family after job.
Forgot to provide mod verions: silent-gear-1.21.1-neoforge-4.0.8. The_Undergarden-1.21.1-0.8.22
This is two different incompatibilities.
- Undergarden seems to assume nobody will ever query the damage value of an
ItemStackbefore a world is loaded. I'd blame that on them since Minecraft does constructItemStacks before world load and assuming that no mod will query the damage of one of those stacks seems rather brittle. - ~Silentlib~ SilentGear somehow wants to construct a new
ItemStackevery time one of its items is asked for its damage, and Baritone reads the damage of every newItemStack, leading to infinite recursion. While I think constructing a newItemStackingetDamageis a weird thing to do, I also think this one is on Baritone to fix.
Also I might have to read some mc code again to check whether the hashing trick Baritone is doing is even needed/correct. Now that ItemStacks use immutable components there might be better ways to get what we want.
I have little to no idea what you just said here, but I am grateful for your knowledge! Happy coding!
is there a way to fix it?
is there a way to fix it?
@imfakeheart I did not find a way. You can only disable both of the mods and then it works, but since these mods have quest lines, I just gave up on Baritone for now.
We can only hope that @ZacSharp will manage to at least fix SilentLib issue, since The Undergarden might not be fixable from his side (based on his comment).
The problem is that I don't even get to test simple prs like the latest merge pr I opened and reading up on mc internals takes more time than that. (Testing also has constraints like having the right PC nearby) Someone else having a look at this could definitely speed things up.
of course, idk much about other languages besides PAWN, which i have mastered perfectly, but i learn very quickly, so if you direct me in the right direction, i can try to fix this bug
Hey, just wanted to let you guys know I was just made aware of the Undergarden side of this issue and have a fix pushed. I'll get a build uploaded to CF when I get some time
Thank you.
That leaves the harder one open. For newer versions I think the fix is hashing a selected subset of data components rather than the damage value, for 1.19.4 I don't know. From Baritones side we are already just reading a field without running code, but Neoforge turns that field into an accessor method, which ~silentlib~ silentgear turns into a recursion crash. The only idea I got to sidestep this is calculating the hash lazily.
EDIT: just read the code again and apparently we are calling a method?
I fixed it. Went in to SilentGear and added some ThreadLocal flags to detect when it was already calculating damage values, same for ItemStacks.
// Thread-local flag to prevent recursion
private static final ThreadLocal<Boolean> CALCULATING_MAX_DAMAGE = ThreadLocal.withInitial(() -> Boolean.FALSE);
// Keep track of stacks we're currently processing to prevent specific item recursion
private static final ThreadLocal<Set<ItemStack>> PROCESSING_STACKS = ThreadLocal.withInitial(() -> new HashSet<>());
Just a small snippet of what I changed. If someone wants it, I can provide the MainPartItem.java and the PartInstance.java that includes the fixes and then you can compile it yourself.
I fixed it. Went in to SilentGear and added some ThreadLocal flags to detect when it was already calculating damage values, same for ItemStacks.
// Thread-local flag to prevent recursion private static final ThreadLocal<Boolean> CALCULATING_MAX_DAMAGE = ThreadLocal.withInitial(() -> Boolean.FALSE); // Keep track of stacks we're currently processing to prevent specific item recursion private static final ThreadLocal<Set<ItemStack>> PROCESSING_STACKS = ThreadLocal.withInitial(() -> new HashSet<>());Just a small snippet of what I changed. If someone wants it, I can provide the MainPartItem.java and the PartInstance.java that includes the fixes and then you can compile it yourself.
How would I go about fixing it? I'm playing ATM10 and would love to get Baritone working
You can test applying the patch from #4687 to whatever Baritone version you need and build from that.
You can test applying the patch from #4687 to whatever Baritone version you need and build from that.
It's untested? Oke, can try it...
Fix #4687 tested. Client successfully connected to server, baritone successfully initialised. Mine command was tested and successfully started pathing towards target ore.
Can i get some help. I have no idea what is being said in this, but I want to use Baritone for ATM 10. Can someone tell me how to do it like I'm a child?
Can i get some help. I have no idea what is being said in this, but I want to use Baritone for ATM 10. Can someone tell me how to do it like I'm a child?
I'm gonna be honest I've a terrible memory and don't know exactly how I did it, but this should work. Go here: https://github.com/cabaletta/baritone/actions/runs/14049206723 via clicking on #4687 > checks tab > Java CLI with Gradle (or just copy/pasting the url) Then download "Artifacts" by clicking the download icon to the right of the series of numbers and letters. Inside the zip that gets downloaded will be the .jar files you can use for ATM10, make sure you use the right version! ATM10 is Neoforge!
Can i get some help. I have no idea what is being said in this, but I want to use Baritone for ATM 10. Can someone tell me how to do it like I'm a child?
I'm gonna be honest I've a terrible memory and don't know exactly how I did it, but this should work. Go here: https://github.com/cabaletta/baritone/actions/runs/14049206723 via clicking on #4687 > checks tab > Java CLI with Gradle (or just copy/pasting the url) Then download "Artifacts" by clicking the download icon to the right of the series of numbers and letters. Inside the zip that gets downloaded will be the .jar files you can use for ATM10, make sure you use the right version! ATM10 is Neoforge!
The artifact.zip mentioned appears to be missing the neoforge version
Ah, in that case you'll have to compile your own version - I also realise the linked version is the wrong Minecraft version.
You'll have to download the repository from the 1.21.1 branch - or whatever version you need - and manually change the files as seen in #4687 Once you've done that, simply open a command prompt in the folder, and type in "gradlew build" and once it's done the files will show up in the "dist" folder.
I'd send you the .jar file I compiled, but you really shouldn't trust random .jar files sent over the internet as they're executables - also GitHub won't let me unless I use a third party site.
Could you walk me through step by step. The most ive ever done is drag and drop files lmao. Im so lost :-(
Could you walk me through step by step. The most ive ever done is drag and drop files lmao. Im so lost :-(
@FenekkuKitsune was pretty straight forward with his instructions.
Go to baritone, change branch to 1.21.1, download source as zip, go see what files/code was changed in #4687, and apply those to the files you downloaded, recompile
The game crashed: initializing game Error: java.lang.IllegalStateException: Mod 'architectury' is not available!
This is the error i get now. I have architectury downloaded though.
@Sanctifyed you either grabbed the wrong file from "dist", or incorrectly implemented the file changes.
As mentioned above, I compiled and packaged this If anyone needs it
omg thank you so much this was exactly what i needed.