From 1a6183000af4d00ea0a621345277db51dc8fae0f Mon Sep 17 00:00:00 2001 From: DesiCow Date: Sun, 22 Jan 2023 19:40:17 +0530 Subject: [PATCH] Add onlyOnClick setting to Scaffold module --- .../meteorclient/mixin/ClientPlayerEntityMixin.java | 2 +- .../systems/modules/movement/Scaffold.java | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java index ab54e5df7a..31e36e79e1 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java @@ -55,7 +55,7 @@ private boolean redirectUsingItem(ClientPlayerEntity player) { @Inject(method = "isSneaking", at = @At("HEAD"), cancellable = true) private void onIsSneaking(CallbackInfoReturnable info) { - if (Modules.get().isActive(Scaffold.class)) info.setReturnValue(false); + if (Modules.get().get(Scaffold.class).scaffolding()) info.setReturnValue(false); } @Inject(method = "shouldSlowDown", at = @At("HEAD"), cancellable = true) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java index 880959248a..e6b7707f66 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java @@ -55,6 +55,13 @@ public class Scaffold extends Module { .build() ); + private final Setting onlyOnClick = sgGeneral.add(new BoolSetting.Builder() + .name("only-on-click") + .description("Only places blocks when holding right click.") + .defaultValue(false) + .build() + ); + private final Setting renderSwing = sgGeneral.add(new BoolSetting.Builder() .name("swing") .description("Renders your client-side swing.") @@ -153,6 +160,8 @@ public void onActivate() { @EventHandler private void onTick(TickEvent.Pre event) { + if (onlyOnClick.get() && !mc.options.useKey.isPressed()) return; + if (airPlace.get()) { Vec3d vec = mc.player.getPos().add(mc.player.getVelocity()).add(0, -0.5f, 0); bp.set(vec.getX(), vec.getY(), vec.getZ()); @@ -238,6 +247,10 @@ private void onTick(TickEvent.Pre event) { } } + public boolean scaffolding() { + return isActive() && (!onlyOnClick.get() || (onlyOnClick.get() && mc.options.useKey.isPressed())); + } + private boolean validItem(ItemStack itemStack, BlockPos pos) { if (!(itemStack.getItem() instanceof BlockItem)) return false;