我目前正在制作一个涉及寻路的 1.12.2 Forge mod,所以我决定使用 Baritone。谁能帮助我实际访问 API?我目前正在做的是使用 BaritoneAPI.getProvider()
手动访问它,这会导致它崩溃。
根据 Baritone 的作者的说法,“Baritone 的 forge jar 是 notch 映射的,并且依赖于运行时重新映射来搜索。如果您手动加载 BaritoneAPI
类,或者以其他方式欺骗 forge 认为它不需要重新映射 baritone,它就会像这样崩溃。”
访问 Baritone API 的正确方法是什么?
更新:我暂时使用 EntityPlayerSP#sendChatMessage(String)
并强制玩家使用 Baritone 聊天命令。
最佳答案
我目前无法尝试,所以我不知道这是否会导致您提到的问题,但看起来使用 API 应该很容易。
来自here :
BaritoneAPI.getSettings().allowSprint.value = true;
BaritoneAPI.getSettings().primaryTimeoutMS.value = 2000L;
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ(10000, 20000));
还有一点需要注意的是,使用 API 时必须使用特殊版本。
来自here :
Please note that usage of anything located outside of the
baritone.api
package is not supported by the API release jar.
指的是specially packaged API releases ,可以找到here .
关于java - 将 Baritone API 实现到 Minecraft Forge mod 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59003942/