possible fix to concurrentmodificationexception on path start

This commit is contained in:
Leijurv 2018-09-04 08:56:34 -07:00
parent f51bcc8b89
commit 438392840b
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 3 additions and 6 deletions

View File

@ -21,6 +21,7 @@ import baritone.api.event.GameEventHandler;
import baritone.behavior.Behavior; import baritone.behavior.Behavior;
import baritone.behavior.impl.*; import baritone.behavior.impl.*;
import baritone.utils.InputOverrideHandler; import baritone.utils.InputOverrideHandler;
import baritone.utils.ToolSet;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import java.io.File; import java.io.File;
@ -81,6 +82,7 @@ public enum Baritone {
registerBehavior(LocationTrackingBehavior.INSTANCE); registerBehavior(LocationTrackingBehavior.INSTANCE);
registerBehavior(FollowBehavior.INSTANCE); registerBehavior(FollowBehavior.INSTANCE);
registerBehavior(MineBehavior.INSTANCE); registerBehavior(MineBehavior.INSTANCE);
this.gameEventHandler.registerEventListener(ToolSet.INTERNAL_EVENT_LISTENER);
} }
this.dir = new File(Minecraft.getMinecraft().gameDir, "baritone"); this.dir = new File(Minecraft.getMinecraft().gameDir, "baritone");
if (!Files.exists(dir.toPath())) { if (!Files.exists(dir.toPath())) {

View File

@ -17,7 +17,6 @@
package baritone.utils; package baritone.utils;
import baritone.Baritone;
import baritone.api.event.events.ItemSlotEvent; import baritone.api.event.events.ItemSlotEvent;
import baritone.api.event.listener.AbstractGameEventListener; import baritone.api.event.listener.AbstractGameEventListener;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -46,11 +45,7 @@ public class ToolSet implements Helper {
/** /**
* Instance of the internal event listener used to hook into Baritone's event bus * Instance of the internal event listener used to hook into Baritone's event bus
*/ */
private static final InternalEventListener INTERNAL_EVENT_LISTENER = new InternalEventListener(); public static final InternalEventListener INTERNAL_EVENT_LISTENER = new InternalEventListener();
static {
Baritone.INSTANCE.getGameEventHandler().registerEventListener(INTERNAL_EVENT_LISTENER);
}
/** /**
* A list of tools on the hotbar that should be considered. * A list of tools on the hotbar that should be considered.