简体   繁体   中英

Implementing Baritone API into a Minecraft Forge mod

I'm currently making a 1.12.2 Forge mod that involves pathfinding, so I decided to use Baritone. Can anyone help me with actually accessing the API? What I'm currently doing is manually accessing it with BaritoneAPI.getProvider() , which crashes it.

According to the author of Baritone, "Baritone's forge jar is notch mapped, and relies on runtime remapping to searge. If you manually load the BaritoneAPI class, or otherwise trick forge into thinking that it doesn't need to remap baritone, it will crash like this."

What's the proper way of accessing the Baritone API?

Update: I've resorted to using EntityPlayerSP#sendChatMessage(String) and forcing the player to use a Baritone chat command for now.

I can't try it at the moment, so I don't know if this leads to the problem you mentioned, but it looks like it should be easy enough to use the API.

From here :

BaritoneAPI.getSettings().allowSprint.value = true;
BaritoneAPI.getSettings().primaryTimeoutMS.value = 2000L;

BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ(10000, 20000));

Another thing to note is that when using the API you must use a special release.

From here :

Please note that usage of anything located outside of the baritone.api package is not supported by the API release jar.

Which refers to the specially packaged API releases , which can be found here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM