Skip to content

Commit

Permalink
Make BlockIn always work when flying or midair (#227)
Browse files Browse the repository at this point in the history
Co-authored-by: Cloudburst <[email protected]>
  • Loading branch information
etianl and C10udburst authored Feb 28, 2023
1 parent e1a9b11 commit 4fbc7e3
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/main/java/anticope/rejects/modules/BlockIn.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4fbc7e3

Please sign in to comment.