Fixing crash after clicking into the air

This commit is contained in:
kuthy 2020-07-03 15:36:44 +02:00
parent 80c8294f5f
commit 8262909063
No known key found for this signature in database
GPG Key ID: 28CD9435B33672CF

View File

@ -93,10 +93,16 @@ public class GuiClick extends GuiScreen {
Helper.HELPER.logDirect(component);
clickStart = null;
} else {
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalTwoBlocks(currentMouseOver));
if(currentMouseOver != null)//Catch this, or else a click into void will result in a crash
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver));
else
Helper.HELPER.logDirect("Sorry, I can't go to nothing");
}
} else if (mouseButton == 1) {
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver.up()));
if(currentMouseOver != null)
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver.up()));
else
Helper.HELPER.logDirect("Sorry, I can't go to nothing");
}
clickStart = null;
}