Skip to content

Added Silent Mine module #5442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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 @@ -443,6 +443,7 @@ private void initPlayer() {
add(new PotionSaver());
add(new Reach());
add(new Rotation());
add(new SilentMine());
add(new SpeedMine());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
* Copyright (c) Meteor Development.
*/

package meteordevelopment.meteorclient.systems.modules.player;

import meteordevelopment.meteorclient.events.packets.PacketEvent;
import meteordevelopment.meteorclient.events.world.TickEvent;
import meteordevelopment.meteorclient.systems.modules.Categories;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;

public class SilentMine extends Module {
public SilentMine() {
super(Categories.Player, "silent-mine", "Prevents block breaking animations from being visible to other players.");
}

private boolean mining;
private BlockPos lastBlockPos;
private Direction lastDirection;

@Override
public void onDeactivate() {
mining = false;
}

@EventHandler
private void onSendPacket(PacketEvent.Send event) {
if (!(event.packet instanceof PlayerActionC2SPacket)) return;

PlayerActionC2SPacket packet = (PlayerActionC2SPacket) event.packet;

if (packet.getAction() == PlayerActionC2SPacket.Action.START_DESTROY_BLOCK) {
mining = true;
lastBlockPos = packet.getPos();
lastDirection = packet.getDirection();
}

if (packet.getAction() == PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK) {
mining = false;
}
}

@EventHandler
private void onTick(TickEvent.Pre event) {
if (mining) {
mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.ABORT_DESTROY_BLOCK, lastBlockPos, lastDirection));
}
}
}