mirror of https://github.com/cabaletta/baritone
add clickCancel, fixes #326
This commit is contained in:
parent
9a29f9ce57
commit
d0d8b12fb8
|
@ -378,6 +378,11 @@ public final class Settings {
|
|||
*/
|
||||
public final Setting<Boolean> pruneRegionsFromRAM = new Setting<>(false);
|
||||
|
||||
/**
|
||||
* Cancel baritone on left click, as a form of "panic button"
|
||||
*/
|
||||
public final Setting<Boolean> clickCancel = new Setting<>(false);
|
||||
|
||||
/**
|
||||
* Remember the contents of containers (chests, echests, furnaces)
|
||||
* <p>
|
||||
|
|
|
@ -20,6 +20,7 @@ package baritone.launch.mixins;
|
|||
import baritone.Baritone;
|
||||
import baritone.api.BaritoneAPI;
|
||||
import baritone.utils.Helper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
@ -61,6 +62,9 @@ public class MixinKeyBinding {
|
|||
private void isPressed(CallbackInfoReturnable<Boolean> cir) {
|
||||
// only the primary baritone forces keys
|
||||
Boolean force = BaritoneAPI.getProvider().getPrimaryBaritone().getInputOverrideHandler().isInputForcedDown((KeyBinding) (Object) this);
|
||||
if (pressTime > 0 && (KeyBinding) (Object) this == Minecraft.getMinecraft().gameSettings.keyBindAttack && Baritone.settings().clickCancel.get()) {
|
||||
BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().cancelEverything();
|
||||
}
|
||||
if (force != null && !force && Baritone.settings().suppressClicks.get()) { // <-- cursed
|
||||
if (pressTime > 0) {
|
||||
Helper.HELPER.logDirect("You're trying to press this mouse button but I won't let you.");
|
||||
|
|
Loading…
Reference in New Issue