mirror of https://github.com/cabaletta/baritone
behavior can't be null in onTick
This commit is contained in:
parent
ba78c48a75
commit
38553b3324
|
@ -78,14 +78,13 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro
|
|||
@Override
|
||||
public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) {
|
||||
final long seedSetting = Baritone.settings().elytraNetherSeed.value;
|
||||
if (this.behavior != null && seedSetting != behavior.context.getSeed()) {
|
||||
if (seedSetting != behavior.context.getSeed()) {
|
||||
logDirect("Nether seed changed, recalculating path");
|
||||
this.resetState();
|
||||
}
|
||||
|
||||
if (this.behavior != null) {
|
||||
this.behavior.onTick();
|
||||
}
|
||||
|
||||
if (calcFailed) {
|
||||
onLostControl();
|
||||
logDirect("Failed to get to jump off spot, canceling");
|
||||
|
@ -199,9 +198,11 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro
|
|||
public void onLostControl() {
|
||||
this.goal = null;
|
||||
this.state = State.START_FLYING; // TODO: null state?
|
||||
if (this.behavior != null) this.behavior.destroy();
|
||||
if (this.behavior != null) {
|
||||
this.behavior.destroy();
|
||||
this.behavior = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String displayName0() {
|
||||
|
@ -210,8 +211,10 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro
|
|||
|
||||
@Override
|
||||
public void repackChunks() {
|
||||
if (this.behavior != null) {
|
||||
this.behavior.repackChunks();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos currentDestination() {
|
||||
|
@ -260,14 +263,12 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro
|
|||
|
||||
@Override
|
||||
public void onWorldEvent(WorldEvent event) {
|
||||
if (event.getWorld() != null && event.getState() == EventState.POST) {
|
||||
if (event.getWorld() != null && event.getState() == EventState.POST && this.behavior != null) {
|
||||
// Exiting the world, just destroy
|
||||
if (this.behavior != null) {
|
||||
this.behavior.destroy();
|
||||
this.behavior = new LegacyElytraBehavior(baritone, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkEvent(ChunkEvent event) {
|
||||
|
|
Loading…
Reference in New Issue