Merge pull request #1845 from mariusdkm/master
Fixing crash after clicking into the air using the #click command
This commit is contained in:
commit
5eeb33a6f5
@ -20,7 +20,6 @@ package baritone.utils;
|
||||
import baritone.Baritone;
|
||||
import baritone.api.BaritoneAPI;
|
||||
import baritone.api.pathing.goals.GoalBlock;
|
||||
import baritone.api.pathing.goals.GoalTwoBlocks;
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
import baritone.api.utils.Helper;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@ -43,8 +42,8 @@ import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
import static baritone.api.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
public class GuiClick extends GuiScreen {
|
||||
|
||||
@ -79,6 +78,7 @@ public class GuiClick extends GuiScreen {
|
||||
|
||||
@Override
|
||||
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 (clickStart != null && !clickStart.equals(currentMouseOver)) {
|
||||
BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().removeAllSelections();
|
||||
@ -93,11 +93,12 @@ public class GuiClick extends GuiScreen {
|
||||
Helper.HELPER.logDirect(component);
|
||||
clickStart = null;
|
||||
} else {
|
||||
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalTwoBlocks(currentMouseOver));
|
||||
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver));
|
||||
}
|
||||
} else if (mouseButton == 1) {
|
||||
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver.up()));
|
||||
}
|
||||
}
|
||||
clickStart = null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user