From 4fbc7e37253d2133706319ea113f98737909430b Mon Sep 17 00:00:00 2001 From: etianl <115842502+etianl@users.noreply.github.com> Date: Tue, 28 Feb 2023 13:01:26 -0800 Subject: [PATCH] Make BlockIn always work when flying or midair (#227) Co-authored-by: Cloudburst <18114966+C10udburst@users.noreply.github.com> --- .../java/anticope/rejects/modules/BlockIn.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/anticope/rejects/modules/BlockIn.java b/src/main/java/anticope/rejects/modules/BlockIn.java index 251d4a91..2e5547e4 100644 --- a/src/main/java/anticope/rejects/modules/BlockIn.java +++ b/src/main/java/anticope/rejects/modules/BlockIn.java @@ -1,6 +1,8 @@ package anticope.rejects.modules; import anticope.rejects.MeteorRejectsAddon; +import net.minecraft.entity.MovementType; +import net.minecraft.util.math.Vec3d; import meteordevelopment.meteorclient.events.world.TickEvent; import meteordevelopment.meteorclient.settings.BoolSetting; import meteordevelopment.meteorclient.settings.Setting; @@ -57,14 +59,26 @@ public class BlockIn extends Module { private final BlockPos.Mutable bp = new BlockPos.Mutable(); private boolean return_; + private double sY; public BlockIn() { super(MeteorRejectsAddon.CATEGORY, "block-in", "Block yourself in using any block."); } + @Override + public void onActivate() { + sY = mc.player.getPos().getY(); + } + @EventHandler private void onPreTick(TickEvent.Pre event) { - if (center.get()) PlayerUtils.centerPlayer(); + if (center.get()) { + if (!onlyOnGround.get()) { + mc.player.setVelocity(0,0,0); + mc.player.move(MovementType.SELF, new Vec3d(0, -(sY-Math.floor(sY)), 0)); + } + PlayerUtils.centerPlayer(); + } if (onlyOnGround.get() && !mc.player.isOnGround()) return; return_ = false;