java.lang.IllegalStateException When I run mine() on a different thread.
hykilpikonna opened this issue ยท 1 comments
Problem: Calling BaritoneAPI.getProvider().getPrimaryBaritone().getMineProcess().mine(...);
throws this exception when not on main thread.
[20:26:35] [Thread-11/INFO]: [STDERR]: java.lang.IllegalStateException
[20:26:35] [Thread-11/INFO]: [STDERR]: at baritone.utils.BlockStateInterface.<init>(BlockStateInterface.java:74)
[20:26:35] [Thread-11/INFO]: [STDERR]: at baritone.pathing.movement.CalculationContext.<init>(CalculationContext.java:85)
[20:26:35] [Thread-11/INFO]: [STDERR]: at baritone.pathing.movement.CalculationContext.<init>(CalculationContext.java:76)
[20:26:35] [Thread-11/INFO]: [STDERR]: at baritone.process.MineProcess.mine(MineProcess.java:440)
[20:26:35] [Thread-11/INFO]: [STDERR]: at baritone.api.process.IMineProcess.mine(IMineProcess.java:95)
[20:26:35] [Thread-11/INFO]: [STDERR]: at baritone.api.process.IMineProcess.mine(IMineProcess.java:108)
...
[20:26:35] [Thread-11/INFO]: [STDERR]: at java.lang.Thread.run(Thread.java:748)
Problematic code:
// at baritone.utils.BlockStateInterface.<init>(BlockStateInterface.java:74)
if (!MinecraftClient.getInstance().isOnThread()) {
throw new IllegalStateException();
}
Why did you throw this when on a different thread? My mod kind of needs to call the api asynchronously.