Baritone AI pathfinder

Baritone AI pathfinder

72.7k Downloads

Client crushing on load because of NoClassDefFoundError

JixCan opened this issue ยท 8 comments

commented

Some information

Operating system: WIndows
Java version: 8
Minecraft version: 1.12.2
Baritone version: 1.2.17
Other mods (if used):

Exception, error or logs

WARNING: coremods are present:
Contact their authors BEFORE contacting forge

// There are four lights!

Time: 7/26/23 7:03 PM
Description: Initializing game

java.lang.NoClassDefFoundError: baritone/api/pathing/goals/Goal
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:539)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
at com.google.common.eventbus.EventBus.post(EventBus.java:217)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:219)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
at com.google.common.eventbus.EventBus.post(EventBus.java:217)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:136)
at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:595)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:232)
at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:467)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:378)
at net.minecraft.client.main.Main.main(SourceFile:123)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
Caused by: java.lang.ClassNotFoundException: baritone.api.pathing.goals.Goal
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 39 more
Caused by: java.lang.NullPointerException
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:182)
... 41 more

I used BaritoneAPI in my mod and getting NoClassDefFoundError every time I'm trying to load the client with my mod.
The only lines of code that use Baritone API (it's your example btw):

BaritoneAPI.getSettings().allowSprint.value = true;
BaritoneAPI.getSettings().primaryTimeoutMS.value = 2000L;
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ(blockPos.getX(), blockPos.getZ()));

Final checklist

  • I know how to properly use check boxes
  • I have included the version of Minecraft I'm running, baritone's version and forge mods (if used).
  • I have included logs, exceptions and / or steps to reproduce the issue.
  • I have not used any OwO's or UwU's in this issue.
commented

Which Baritone jar are you using? The standalone jars are not made to be used by other mods (hence the name).

commented

Which Baritone jar are you using? The standalone jars are not made to be used by other mods (hence the name).

https://github.com/cabaletta/baritone/releases/download/v1.2.17/baritone-api-forge-1.2.17.jar this one. If this is a standalone jar, where should I get .jar for my mod?

PS. Accidentally closed

commented

baritone-api-* is exactly what you need (standalone is baritone-standalone-*) so that's not the problem.
You did put that jar into your mods folder, right? (Assuming this is not in your development environment because there's srg names in the stack trace)

commented

baritone-api-* is exactly what you need (standalone is baritone-standalone-*) so that's not the problem. You did put that jar into your mods folder, right? (Assuming this is not in your development environment because there's srg names in the stack trace)

I didn't. I put baritone jar into /libs folder in my workspace, built my project and put my mod jar into /mods.

commented

and how did you import the jar from the libs folder into your project (ie. what's the dependency statement look like)

commented

and how did you import the jar from the libs folder into your project (ie. what's the dependency statement look like)

dependencies {
minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2859'
compile fileTree(dir: 'libs', include: 'baritone-api-forge-1.2.17.jar')
}

commented

To fix the problem you can either put the baritone jar in your mods folder, or use a gradle plugin like shadow to easily include the baritone classes in your mod jar.

commented

Thanks