Make BlockIn always work when flying or midair (#227)
Co-authored-by: Cloudburst <18114966+C10udburst@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package anticope.rejects.modules;
|
package anticope.rejects.modules;
|
||||||
|
|
||||||
import anticope.rejects.MeteorRejectsAddon;
|
import anticope.rejects.MeteorRejectsAddon;
|
||||||
|
import net.minecraft.entity.MovementType;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||||
import meteordevelopment.meteorclient.settings.BoolSetting;
|
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||||
import meteordevelopment.meteorclient.settings.Setting;
|
import meteordevelopment.meteorclient.settings.Setting;
|
||||||
@@ -57,14 +59,26 @@ public class BlockIn extends Module {
|
|||||||
|
|
||||||
private final BlockPos.Mutable bp = new BlockPos.Mutable();
|
private final BlockPos.Mutable bp = new BlockPos.Mutable();
|
||||||
private boolean return_;
|
private boolean return_;
|
||||||
|
private double sY;
|
||||||
|
|
||||||
public BlockIn() {
|
public BlockIn() {
|
||||||
super(MeteorRejectsAddon.CATEGORY, "block-in", "Block yourself in using any block.");
|
super(MeteorRejectsAddon.CATEGORY, "block-in", "Block yourself in using any block.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivate() {
|
||||||
|
sY = mc.player.getPos().getY();
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
private void onPreTick(TickEvent.Pre event) {
|
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;
|
if (onlyOnGround.get() && !mc.player.isOnGround()) return;
|
||||||
|
|
||||||
return_ = false;
|
return_ = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user