Search in sources :

Example 11 with EventHandler

use of mathax.client.eventbus.EventHandler in project Client by MatHax.

the class Gravity method onTick.

@EventHandler
private void onTick(final TickEvent.Post event) {
    if (mc.options.sneakKey.isPressed())
        return;
    Vec3d velocity = mc.player.getVelocity();
    ((IVec3d) velocity).set(velocity.x, velocity.y + 0.0568000030517578, velocity.z);
}
Also used : IVec3d(mathax.client.mixininterface.IVec3d) Vec3d(net.minecraft.util.math.Vec3d) IVec3d(mathax.client.mixininterface.IVec3d) EventHandler(mathax.client.eventbus.EventHandler)

Example 12 with EventHandler

use of mathax.client.eventbus.EventHandler in project Client by MatHax.

the class BoatFly method onBoatMove.

@EventHandler
private void onBoatMove(BoatMoveEvent event) {
    if (event.boat.getPrimaryPassenger() != mc.player)
        return;
    event.boat.setYaw(mc.player.getYaw());
    Vec3d vel = PlayerUtils.getHorizontalVelocity(speed.get());
    double velX = vel.getX();
    double velY = 0;
    double velZ = vel.getZ();
    if (mc.options.jumpKey.isPressed())
        velY += verticalSpeed.get() / 20;
    if (mc.options.sprintKey.isPressed())
        velY -= verticalSpeed.get() / 20;
    else
        velY -= fallSpeed.get() / 20;
    ((IVec3d) event.boat.getVelocity()).set(velX, velY, velZ);
}
Also used : IVec3d(mathax.client.mixininterface.IVec3d) Vec3d(net.minecraft.util.math.Vec3d) IVec3d(mathax.client.mixininterface.IVec3d) EventHandler(mathax.client.eventbus.EventHandler)

Example 13 with EventHandler

use of mathax.client.eventbus.EventHandler in project Client by MatHax.

the class Phase method onTick.

@EventHandler
public void onTick(TickEvent.Pre event) {
    if (mode.get() != Mode.No_NCP)
        return;
    double blocks = clipDistance.get();
    if (!mc.player.isOnGround())
        return;
    if (mc.options.forwardKey.isPressed()) {
        Vec3d forward = Vec3d.fromPolar(0, mc.player.getYaw());
        mc.player.updatePosition(mc.player.getX() + forward.x * blocks, mc.player.getY(), mc.player.getZ() + forward.z * blocks);
    }
    if (mc.options.backKey.isPressed()) {
        Vec3d forward = Vec3d.fromPolar(0, mc.player.getYaw() - 180);
        mc.player.updatePosition(mc.player.getX() + forward.x * blocks, mc.player.getY(), mc.player.getZ() + forward.z * blocks);
    }
    if (mc.options.leftKey.isPressed()) {
        Vec3d forward = Vec3d.fromPolar(0, mc.player.getYaw() - 90);
        mc.player.updatePosition(mc.player.getX() + forward.x * blocks, mc.player.getY(), mc.player.getZ() + forward.z * blocks);
    }
    if (mc.options.rightKey.isPressed()) {
        Vec3d forward = Vec3d.fromPolar(0, mc.player.getYaw() - 270);
        mc.player.updatePosition(mc.player.getX() + forward.x * blocks, mc.player.getY(), mc.player.getZ() + forward.z * blocks);
    }
    if (mc.options.jumpKey.isPressed())
        mc.player.updatePosition(mc.player.getX(), mc.player.getY() + 0.05, mc.player.getZ());
    if (mc.options.sneakKey.isPressed())
        mc.player.updatePosition(mc.player.getX(), mc.player.getY() - 0.05, mc.player.getZ());
}
Also used : Vec3d(net.minecraft.util.math.Vec3d) EventHandler(mathax.client.eventbus.EventHandler)

Example 14 with EventHandler

use of mathax.client.eventbus.EventHandler in project Client by MatHax.

the class Phase method onTick.

@EventHandler
private void onTick(TickEvent.Post event) {
    if (mode.get() == Mode.Collision_Shape || mode.get() == Mode.No_NCP)
        return;
    if (mc.player == null)
        return;
    if (Double.isNaN(prevX) || Double.isNaN(prevZ))
        setPos();
    Vec3d yawForward = Vec3d.fromPolar(0.0f, mc.player.getYaw());
    Vec3d yawBack = Vec3d.fromPolar(0.0f, mc.player.getYaw() - 180f);
    Vec3d yawLeft = Vec3d.fromPolar(0.0f, mc.player.getYaw() - 90f);
    Vec3d yawRight = Vec3d.fromPolar(0.0f, mc.player.getYaw() - 270f);
    if (mode.get() == Mode.Normal) {
        if (mc.options.forwardKey.isPressed())
            mc.player.setPos(mc.player.getX() + yawForward.x * distance.get(), mc.player.getY(), mc.player.getZ() + yawForward.z * distance.get());
        if (mc.options.backKey.isPressed())
            mc.player.setPos(mc.player.getX() + yawBack.x * distance.get(), mc.player.getY(), mc.player.getZ() + yawBack.z * distance.get());
        if (mc.options.leftKey.isPressed())
            mc.player.setPos(mc.player.getX() + yawLeft.x * distance.get(), mc.player.getY(), mc.player.getZ() + yawLeft.z * distance.get());
        if (mc.options.rightKey.isPressed())
            mc.player.setPos(mc.player.getX() + yawRight.x * distance.get(), mc.player.getY(), mc.player.getZ() + yawRight.z * distance.get());
    } else if (mode.get() == Mode.NRNB) {
        if (mc.options.forwardKey.isPressed()) {
            prevX += yawForward.x * distance.get();
            prevZ += yawForward.z * distance.get();
            mc.player.setPos(prevX, mc.player.getY(), prevZ);
        }
        if (mc.options.backKey.isPressed()) {
            prevX += yawBack.x * distance.get();
            prevZ += yawBack.z * distance.get();
            mc.player.setPos(prevX, mc.player.getY(), prevZ);
        }
        if (mc.options.leftKey.isPressed()) {
            prevX += yawLeft.x * distance.get();
            prevZ += yawLeft.z * distance.get();
            mc.player.setPos(prevX, mc.player.getY(), prevZ);
        }
        if (mc.options.rightKey.isPressed()) {
            prevX += yawRight.x * distance.get();
            prevZ += yawRight.z * distance.get();
            mc.player.setPos(prevX, mc.player.getY(), prevZ);
        }
    }
}
Also used : Vec3d(net.minecraft.util.math.Vec3d) EventHandler(mathax.client.eventbus.EventHandler)

Example 15 with EventHandler

use of mathax.client.eventbus.EventHandler in project Client by MatHax.

the class EChestMemory method onOpenScreenEvent.

@EventHandler
private static void onOpenScreenEvent(OpenScreenEvent event) {
    if (echestOpenedState == 1 && event.screen instanceof GenericContainerScreen) {
        echestOpenedState = 2;
        return;
    }
    if (echestOpenedState == 0)
        return;
    if (!(mc.currentScreen instanceof GenericContainerScreen))
        return;
    GenericContainerScreenHandler container = ((GenericContainerScreen) mc.currentScreen).getScreenHandler();
    if (container == null)
        return;
    Inventory inv = container.getInventory();
    for (int i = 0; i < 27; i++) {
        ITEMS.set(i, inv.getStack(i));
    }
    echestOpenedState = 0;
}
Also used : GenericContainerScreen(net.minecraft.client.gui.screen.ingame.GenericContainerScreen) GenericContainerScreenHandler(net.minecraft.screen.GenericContainerScreenHandler) Inventory(net.minecraft.inventory.Inventory) EventHandler(mathax.client.eventbus.EventHandler)

Aggregations

EventHandler (mathax.client.eventbus.EventHandler)80 BlockPos (net.minecraft.util.math.BlockPos)22 FindItemResult (mathax.client.utils.player.FindItemResult)20 Vec3d (net.minecraft.util.math.Vec3d)12 Entity (net.minecraft.entity.Entity)9 PlayerEntity (net.minecraft.entity.player.PlayerEntity)8 BlockState (net.minecraft.block.BlockState)6 Direction (net.minecraft.util.math.Direction)5 ArrayList (java.util.ArrayList)4 TickEvent (mathax.client.events.world.TickEvent)4 IVec3d (mathax.client.mixininterface.IVec3d)4 Categories (mathax.client.systems.modules.Categories)4 Module (mathax.client.systems.modules.Module)4 InvUtils (mathax.client.utils.player.InvUtils)4 ItemStack (net.minecraft.item.ItemStack)4 mathax.client.settings (mathax.client.settings)3 BlockItem (net.minecraft.item.BlockItem)3 BlockHitResult (net.minecraft.util.hit.BlockHitResult)3 Comparator (java.util.Comparator)2 NoFall (mathax.client.systems.modules.movement.NoFall)2