add clickCancel, fixes #326

This commit is contained in:
Leijurv 2019-02-07 17:18:14 -08:00
parent 9a29f9ce57
commit d0d8b12fb8
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 9 additions and 0 deletions

View File

@ -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>

View File

@ -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.");