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,30 +78,26 @@ 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 (mouseButton == 0) { if (currentMouseOver != null) { //Catch this, or else a click into void will result in a crash
if (clickStart != null && !clickStart.equals(currentMouseOver)) { if (mouseButton == 0) {
BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().removeAllSelections(); if (clickStart != null && !clickStart.equals(currentMouseOver)) {
BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().addSelection(BetterBlockPos.from(clickStart), BetterBlockPos.from(currentMouseOver)); BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().removeAllSelections();
ITextComponent component = new TextComponentString("Selection made! For usage: " + Baritone.settings().prefix.value + "help sel"); BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().addSelection(BetterBlockPos.from(clickStart), BetterBlockPos.from(currentMouseOver));
component.getStyle() ITextComponent component = new TextComponentString("Selection made! For usage: " + Baritone.settings().prefix.value + "help sel");
.setColor(TextFormatting.WHITE) component.getStyle()
.setClickEvent(new ClickEvent( .setColor(TextFormatting.WHITE)
ClickEvent.Action.RUN_COMMAND, .setClickEvent(new ClickEvent(
FORCE_COMMAND_PREFIX + "help sel" ClickEvent.Action.RUN_COMMAND,
)); FORCE_COMMAND_PREFIX + "help sel"
Helper.HELPER.logDirect(component); ));
clickStart = null; Helper.HELPER.logDirect(component);
} else { clickStart = null;
if (currentMouseOver != null)//Catch this, or else a click into void will result in a crash } else {
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;
} }