1.12.2 forge sdk baritone api integration
JewFrags opened this issue ยท 14 comments
What do you need help with?
Nothing is happening when i use the api
build.gradle: (mappings, repos, deps etc.)
https://pastebin.com/raw/vCGWKjbW
code:
public class bot {
public bot() {
net.minecraftforge.common.MinecraftForge.EVENT_BUS.register(this);
}
public void runBot() {
if (checks.isPlayerInGameWorld()) {
}
}
@SubscribeEvent
public void onChat(ClientChatEvent event) {
String message = event.getMessage();
if ("#go".equals(message)) {
event.setCanceled(true);
BlockPos currentPos = Minecraft.getMinecraft().player.getPosition();
BlockPos goalPos = currentPos.add(0, 0, 2);
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(goalPos.getX(), goalPos.getY(), goalPos.getZ()));
System.out.println("Baritone walks 2 blocks");
}
}
}
the entire project is up on my repo
In your repo you are using setGoal
rather than setGoalAndPath
.
When you say "Nothing is happening" do you mean you see your debug output ("Baritone walks 2 blocks") but Baritone doesn't move or that your custom command doesn't work at all? Did you test whether Baritone works if you use it directly?
In your repo you are using
setGoal
rather thansetGoalAndPath
. When you say "Nothing is happening" do you mean you see your debug output ("Baritone walks 2 blocks") but Baritone doesn't move or that your custom command doesn't work at all? Did you test whether Baritone works if you use it directly?
The api isn't functioning, i noticed the debug message worked properly
so the command works but can you elaborate on using it directly?
I meant testing whether it works when you e.g. run
goto ~100 ~
you mean with the mod or the api? i'm not familiar with the api if this is something related to that
If I paste your code (from the comment) into an event handler class in one of my workspaces it does make Baritone walk two blocks so I can't find anything wrong with your API usage.
https://pastebin.com/xcdzqBwv crashed when i used !go
you mean with the mod or the api? i'm not familiar with the api if this is something related to that
in chat. Just to make sure Baritone works at all.
yeah i did #goto in chat but it doesnt do anything i assumed this is because this isnt built into the api
here's my gradle
https://pastebin.com/raw/vCGWKjbW
"implementation fg.deobf('cabaletta:baritone-deobf-unoptimized-mcp-dev:1.2').setChanging(true)"
All jars can be used via chat. The only difference is how much of Baritone is obfuscated / optimized. Standalone is completely obfuscated so it has the best performance but the optimization + obfuscation also breaks the api so there's the api jar which comes with less optimizations and with usable api. The unoptimized jar is mainly useful for testing because it produces readable stacktraces.
Since you are using forge you need one of the forge jars (note that there is no unoptimized forge jar for 1.12.2 so you have to use the api-forge one).
so i shouldn't use anything from the impact repo should i use:
implementation files('libs/baritone-api-forge-1.2.19.jar')
Sorry, didn't notice you were using a special mcp mapped build which is not included in normal releases. If you are using this file that should be fine (though slightly outdated. Elytra flight not included). If you want to use one of the regular release builds you will have to include it differently since those are notch mapped (don't ask me how, I always build myself a srg mapped jar if I need Baritone as a dependency).
Looked around some other mods and noticed that Lambda initializes Baritones mixins in their own core mod and my build script contains
runClient {
args "--tweakClass","org.spongepowered.asm.launch.MixinTweaker"
}
You aren't using mixin or a core mod yourself so using the mixin tweaker might work for you as well, but you won't be able to just copypaste that snipped because it's written for a different version of ForgeGradle.
Sorry for the late response I was busy and wasn't able to respond last few weeks
I used 'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
under runs > client
runs {
client {
//...
'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
//...
}
in my build.gradle
is that what you meant? I'm still experiencing the same issue.
No, that's not what I meant. Maybe it's runs.client.tweakClass = ...
or minecraft.tweakClass = ...
or runs.client.args "--tweakClass", "..."
. At least that's what I'd try.
I really can't help you there because I neither know how to specify a tweak class in FG3 nor know of a working example and I'm also not going to try and figure it out by trial and error or dig through internet searches.