Made catch function wide

This commit is contained in:
kuthy 2020-08-18 15:40:12 +02:00
parent 0055a059f7
commit 7f9704592e

View File

@ -78,6 +78,7 @@ public class GuiClick extends GuiScreen {
@Override @Override
protected void mouseReleased(int mouseX, int mouseY, int mouseButton) { protected void mouseReleased(int mouseX, int mouseY, int mouseButton) {
if (currentMouseOver != null) { //Catch this, or else a click into void will result in a crash
if (mouseButton == 0) { if (mouseButton == 0) {
if (clickStart != null && !clickStart.equals(currentMouseOver)) { if (clickStart != null && !clickStart.equals(currentMouseOver)) {
BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().removeAllSelections(); BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().removeAllSelections();
@ -92,16 +93,11 @@ public class GuiClick extends GuiScreen {
Helper.HELPER.logDirect(component); Helper.HELPER.logDirect(component);
clickStart = null; clickStart = null;
} else { } else {
if (currentMouseOver != null)//Catch this, or else a click into void will result in a crash
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver)); BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver));
else
Helper.HELPER.logDirect("Sorry, I can't go to nothing");
} }
} else if (mouseButton == 1) { } else if (mouseButton == 1) {
if (currentMouseOver != null)
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver.up())); BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver.up()));
else }
Helper.HELPER.logDirect("Sorry, I can't go to nothing");
} }
clickStart = null; clickStart = null;
} }