Baritone AI pathfinder

Baritone AI pathfinder

72.7k Downloads

Forge mod integration

antiaim opened this issue ยท 8 comments

commented

What do you need help with?

I can't figure out how to integrate the baritone api jar into a forge mod. There seems to be no documentation on how to do so whatsoever.

Final checklist

  • I have not used any OwO's or UwU's in this issue.
commented

It's easy: Include it as a provided dependency (in your IDE's build system, or Gradle, or whatever you use). Put Baritone's modid in the mcmod.info, or if on 1.13+ mods.toml. Forge will guarantee the dependency is present. Then use the Baritone classes as usual; they are guaranteed to be present. If they aren't, let it crash.

commented

It's easy: Include it as a provided dependency (in your IDE's build system, or Gradle, or whatever you use). Put Baritone's modid in the mcmod.info, or if on 1.13+ mods.toml. Forge will guarantee the dependency is present. Then use the Baritone classes as usual; they are guaranteed to be present. If they aren't, let it crash.

Sorry if i'm wrong, but i don't think baritone is loaded as a traditional mod, with a modid... i can't find baritones mod id anywhere.

commented

i don't think baritone is loaded as a traditional mod, with a modid

Huh, I just checked and it's not. Well then, in preinit just use a Class.forName check with something like baritone.api.BaritoneAPI and you'll be good to go. If you can't find it, then throw an exception or something, crash the game on purpose.

commented

Would it be consistent though. And it still crashes when using baritone classes, something about mapping(?)

[14:56:56] [main/INFO] [mixin]: Compatibility level set to JAVA_8
[14:56:56] [main/ERROR] [mixin]: Mixin config mixins.baritone.json does not specify "minVersion" property
[14:56:56] [main/ERROR] [mixin]: Mixin config mixins.baritone.json does not specify "minVersion" property
[14:56:56] [main/INFO] [mixin]: Initialised Mixin FML Remapper Adapter with net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper@76544c0a
[14:56:56] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[14:56:58] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[14:56:58] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[14:56:58] [main/INFO] [LaunchWrapper]: Loading tweak class name org.spongepowered.asm.mixin.EnvironmentStateTweaker
[14:56:58] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[14:56:58] [main/INFO] [LaunchWrapper]: Calling tweak class org.spongepowered.asm.mixin.EnvironmentStateTweaker
[14:56:59] [main/INFO] [mixin]: Remapping refMap mixins.baritone.refmap.json using C:\Users\entd.gradle\caches\minecraft\de\oceanlabs\mcp\mcp_snapshot\20171003\1.12.2\srgs\srg-mcp.srg
[14:56:59] [main/WARN] [mixin]: Error loading class: aye (java.lang.ClassNotFoundException: The specified class 'aye' was not found)
[14:56:59] [main/WARN] [mixin]: @mixin target aye was not found mixins.baritone.json:MixinAnvilChunkLoader
[14:56:59] [main/WARN] [mixin]: Error loading class: et (java.lang.ClassNotFoundException: The specified class 'et' was not found)
[14:56:59] [main/WARN] [mixin]: @mixin target et was not found mixins.baritone.json:MixinBlockPos
[14:56:59] [main/WARN] [mixin]: Error loading class: brx (java.lang.ClassNotFoundException: The specified class 'brx' was not found)
[14:56:59] [main/WARN] [mixin]: @mixin target brx was not found mixins.baritone.json:MixinChunkProviderClient
[14:56:59] [main/WARN] [mixin]: Error loading class: on (java.lang.ClassNotFoundException: The specified class 'on' was not found)
[14:56:59] [main/WARN] [mixin]: @mixin target on was not found mixins.baritone.json:MixinChunkProviderServer
[14:57:00] [main/WARN] [mixin]: Error loading class: bun (java.lang.ClassNotFoundException: The specified class 'bun' was not found)
[14:57:00] [main/WARN] [mixin]: @mixin target bun was not found mixins.baritone.json:MixinChunkRenderContainer
[14:57:00] [main/FATAL] [mixin]: Mixin prepare failed preparing MixinChunkRenderWorker in mixins.baritone.json: org.spongepowered.asm.mixin.transformer.throwables.InvalidMixinException java.lang.RuntimeException: java.lang.ClassNotFoundException: bxn

commented

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.

commented

I have the forge api jar in /mods, added to the classpath. Is there something retarded that i'm doing?

commented

Update: built mod works when minecraft is launched normally (from launcher), but still doesnt work in ide

commented

closed due to inactivity. reopen if any further questions