mirror of https://github.com/cabaletta/baritone
destroy async
This commit is contained in:
parent
7e9cf2e1e9
commit
36df7b17f8
|
@ -252,8 +252,13 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro
|
||||||
this.landingSpot = null;
|
this.landingSpot = null;
|
||||||
this.reachedGoal = false;
|
this.reachedGoal = false;
|
||||||
this.state = State.START_FLYING; // TODO: null state?
|
this.state = State.START_FLYING; // TODO: null state?
|
||||||
if (this.behavior != null) {
|
destroyBehaviorAsync();
|
||||||
this.behavior.destroy();
|
}
|
||||||
|
|
||||||
|
private void destroyBehaviorAsync() {
|
||||||
|
ElytraBehavior behavior = this.behavior;
|
||||||
|
if (behavior != null) {
|
||||||
|
Baritone.getExecutor().execute(behavior::destroy);
|
||||||
this.behavior = null;
|
this.behavior = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,10 +358,9 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWorldEvent(WorldEvent event) {
|
public void onWorldEvent(WorldEvent event) {
|
||||||
if (event.getWorld() != null && event.getState() == EventState.POST && this.behavior != null) {
|
if (event.getWorld() != null && event.getState() == EventState.POST) {
|
||||||
// Exiting the world, just destroy
|
// Exiting the world, just destroy
|
||||||
this.behavior.destroy();
|
destroyBehaviorAsync();
|
||||||
this.behavior = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue