Search in sources :

Example 1 with IVec3d

use of mathax.client.mixininterface.IVec3d 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 2 with IVec3d

use of mathax.client.mixininterface.IVec3d 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 3 with IVec3d

use of mathax.client.mixininterface.IVec3d in project Client by MatHax.

the class Vanilla method onMove.

@Override
public void onMove(PlayerMoveEvent event) {
    Vec3d vel = PlayerUtils.getHorizontalVelocity(settings.vanillaSpeed.get());
    double velX = vel.getX();
    double velZ = vel.getZ();
    if (mc.player.hasStatusEffect(StatusEffects.SPEED)) {
        double value = (mc.player.getStatusEffect(StatusEffects.SPEED).getAmplifier() + 1) * 0.205;
        velX += velX * value;
        velZ += velZ * value;
    }
    Anchor anchor = Modules.get().get(Anchor.class);
    if (anchor.isActive() && anchor.controlMovement) {
        velX = anchor.deltaX;
        velZ = anchor.deltaZ;
    }
    ((IVec3d) event.movement).set(velX, event.movement.y, velZ);
}
Also used : IVec3d(mathax.client.mixininterface.IVec3d) Anchor(mathax.client.systems.modules.movement.Anchor) Vec3d(net.minecraft.util.math.Vec3d) IVec3d(mathax.client.mixininterface.IVec3d)

Example 4 with IVec3d

use of mathax.client.mixininterface.IVec3d in project Client by MatHax.

the class Strafe method onMove.

@Override
public void onMove(PlayerMoveEvent event) {
    switch(stage) {
        case 0:
            if (PlayerUtils.isMoving()) {
                stage++;
                speed = 1.18f * getDefaultSpeed() - 0.01;
            }
        case 1:
            if (!PlayerUtils.isMoving() || !mc.player.isOnGround())
                break;
            ((IVec3d) event.movement).setY(getHop(0.40123128));
            speed *= settings.ncpSpeed.get();
            stage++;
            break;
        case 2:
            speed = distance - 0.76 * (distance - getDefaultSpeed());
            stage++;
            break;
        case 3:
            if (!mc.world.isSpaceEmpty(mc.player.getBoundingBox().offset(0.0, mc.player.getVelocity().y, 0.0)) || mc.player.verticalCollision && stage > 0) {
                stage = 0;
            }
            speed = distance - (distance / 159.0);
            break;
    }
    speed = Math.max(speed, getDefaultSpeed());
    if (settings.ncpSpeedLimit.get()) {
        if (System.currentTimeMillis() - timer > 2500L)
            timer = System.currentTimeMillis();
        speed = Math.min(speed, System.currentTimeMillis() - timer > 1250L ? 0.44D : 0.43D);
    }
    Vec2 change = transformStrafe(speed);
    double velX = change.x;
    double velZ = change.y;
    Anchor anchor = Modules.get().get(Anchor.class);
    if (anchor.isActive() && anchor.controlMovement) {
        velX = anchor.deltaX;
        velZ = anchor.deltaZ;
    }
    ((IVec3d) event.movement).setXZ(velX, velZ);
}
Also used : IVec3d(mathax.client.mixininterface.IVec3d) Anchor(mathax.client.systems.modules.movement.Anchor) Vec2(mathax.client.utils.misc.Vec2)

Example 5 with IVec3d

use of mathax.client.mixininterface.IVec3d in project Client by MatHax.

the class BlockUtils method place.

public static boolean place(BlockPos blockPos, Hand hand, int slot, boolean rotate, int rotationPriority, boolean swingHand, boolean checkEntities, boolean swapBack) {
    if (slot < 0 || slot > 8)
        return false;
    if (!canPlace(blockPos, checkEntities))
        return false;
    ((IVec3d) hitPos).set(blockPos.getX() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5);
    BlockPos neighbour;
    Direction side = getPlaceSide(blockPos);
    if (side == null) {
        side = Direction.UP;
        neighbour = blockPos;
    } else {
        neighbour = blockPos.offset(side.getOpposite());
        hitPos.add(side.getOffsetX() * 0.5, side.getOffsetY() * 0.5, side.getOffsetZ() * 0.5);
    }
    Direction s = side;
    if (rotate) {
        Rotations.rotate(Rotations.getYaw(hitPos), Rotations.getPitch(hitPos), rotationPriority, () -> {
            InvUtils.swap(slot, swapBack);
            place(new BlockHitResult(hitPos, s, neighbour, false), hand, swingHand);
            if (swapBack)
                InvUtils.swapBack();
        });
    } else {
        InvUtils.swap(slot, swapBack);
        place(new BlockHitResult(hitPos, s, neighbour, false), hand, swingHand);
        if (swapBack)
            InvUtils.swapBack();
    }
    return true;
}
Also used : IVec3d(mathax.client.mixininterface.IVec3d) BlockHitResult(net.minecraft.util.hit.BlockHitResult)

Aggregations

IVec3d (mathax.client.mixininterface.IVec3d)10 Vec3d (net.minecraft.util.math.Vec3d)6 EventHandler (mathax.client.eventbus.EventHandler)4 Anchor (mathax.client.systems.modules.movement.Anchor)2 BlockHitResult (net.minecraft.util.hit.BlockHitResult)2 Vec2 (mathax.client.utils.misc.Vec2)1 Entity (net.minecraft.entity.Entity)1 LivingEntity (net.minecraft.entity.LivingEntity)1