Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import meteordevelopment.meteorclient.systems.modules.movement.GUIMove;
import meteordevelopment.meteorclient.systems.modules.player.FastUse;
import meteordevelopment.meteorclient.systems.modules.player.Multitask;
import meteordevelopment.meteorclient.systems.modules.player.NoInteract;
import meteordevelopment.meteorclient.systems.modules.render.ESP;
import meteordevelopment.meteorclient.systems.modules.world.HighwayBuilder;
import meteordevelopment.meteorclient.utils.Utils;
Expand All @@ -45,6 +46,7 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.profiler.Profilers;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -84,6 +86,9 @@ public abstract class MinecraftClientMixin implements IMinecraftClient {
@Nullable
public ClientPlayerEntity player;

@Shadow
private HitResult crosshairTarget;

@Shadow
@Final
@Mutable
Expand Down Expand Up @@ -116,9 +121,17 @@ private void onTick(CallbackInfo info) {
Profilers.get().pop();
}

@Inject(method = "doAttack", at = @At("HEAD"))
@Inject(method = "doAttack", at = @At("HEAD"), cancellable = true)
private void onAttack(CallbackInfoReturnable<Boolean> cir) {
CPSUtils.onAttack();

NoInteract noInteract = Modules.get().get(NoInteract.class);

if (noInteract.isActive() && noInteract.shouldCancelMissedAttacks() &&
crosshairTarget != null && crosshairTarget.getType() == HitResult.Type.MISS) {
cir.setReturnValue(false);
player.swingHand(Hand.MAIN_HAND, false);
}
}

@Inject(method = "doItemUse", at = @At("HEAD"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ public class NoInteract extends Module {
private final SettingGroup sgBlocks = settings.createGroup("Blocks");
private final SettingGroup sgEntities = settings.createGroup("Entities");

private final Setting<Boolean> cancelMissedAttacks = sgEntities.add(new BoolSetting.Builder()
.name("missed-attacks")
.description("Cancels attacks that didn't hit anything.")
.defaultValue(false)
.build()
);
// Blocks

private final Setting<List<Block>> blockMine = sgBlocks.add(new BlockListSetting.Builder()
Expand Down Expand Up @@ -252,4 +258,7 @@ public enum InteractMode {
Both,
None
}
public boolean shouldCancelMissedAttacks() {
return cancelMissedAttacks.get();
}
}