简体   繁体   English

在 Minecraft Forge 模组中实现 Baritone API

[英]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.我目前正在制作一个涉及寻路的 1.12.2 Forge mod,所以我决定使用 Baritone。 Can anyone help me with actually accessing the API?任何人都可以帮助我实际访问 API 吗? What I'm currently doing is manually accessing it with BaritoneAPI.getProvider() , which crashes it.我目前正在做的是使用BaritoneAPI.getProvider()手动访问它,这会使其崩溃。

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."根据 Baritone 的作者,“Baritone 的 forge jar 是缺口映射的,并且依赖运行时重新映射来搜索。如果您手动加载BaritoneAPI类,或者以其他方式欺骗 Forge 认为它不需要重新映射男中音,它就会崩溃像这样。”

What's the proper way of accessing the Baritone API?访问 Baritone API 的正确方法是什么?

Update: I've resorted to using EntityPlayerSP#sendChatMessage(String) and forcing the player to use a Baritone chat command for now.更新:我EntityPlayerSP#sendChatMessage(String)使用EntityPlayerSP#sendChatMessage(String)并强制玩家使用男中音聊天命令。

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.我目前无法尝试,所以我不知道这是否会导致您提到的问题,但看起来使用 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.另一件需要注意的是,在使用 API 时,您必须使用特殊版本。

From here :这里

Please note that usage of anything located outside of the baritone.api package is not supported by the API release jar.请注意,API 发布 jar 不支持使用baritone.api包之外的任何内容。

Which refers to the specially packaged API releases , which can be found here .这是指专门打包的 API 版本,可以在这里找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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