Search in sources :

Example 6 with IVec3d

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

the class BlockUtils method placeEnhanced.

public static boolean placeEnhanced(BlockPos blockPos, Hand hand, int n, boolean bl, int n2, boolean bl2, boolean bl3, boolean bl4, boolean bl5) {
    BlockPos blockPos1;
    Vec3d vec3d;
    if (n == -1 || !canPlace(blockPos, bl3))
        return false;
    Direction direction = getPlaceSide(blockPos);
    Vec3d vec3d1 = vec3d = bl ? new Vec3d(0.0, 0.0, 0.0) : hitPos;
    if (direction == null) {
        direction = Direction.UP;
        blockPos1 = blockPos;
        ((IVec3d) vec3d).set(blockPos.getX() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5);
    } else {
        blockPos1 = blockPos.offset(direction.getOpposite());
        ((IVec3d) vec3d).set(blockPos1.getX() + 0.5 + direction.getOffsetX() * 0.5, blockPos1.getY() + 0.6 + direction.getOffsetY() * 0.5, blockPos1.getZ() + 0.5 + direction.getOffsetZ() * 0.5);
    }
    if (bl) {
        Direction direction1 = direction;
        Rotations.rotate(Rotations.getYaw(vec3d), Rotations.getPitch(vec3d), n2, () -> placeEnhanced(n, vec3d, hand, direction1, blockPos1, bl2, bl4, bl5));
    } else
        placeEnhanced(n, vec3d, hand, direction, blockPos1, bl2, bl4, bl5);
    return true;
}
Also used : IVec3d(mathax.client.mixininterface.IVec3d) IVec3d(mathax.client.mixininterface.IVec3d)

Example 7 with IVec3d

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

the class CEVBreaker method placeBlock.

private void placeBlock(BlockPos blockPos, int slot, boolean rotate) {
    if (slot == -1)
        return;
    if (!BlockUtils.canPlace(blockPos, true))
        return;
    if (!assertionsDisabled && mc.player == null)
        throw new AssertionError();
    int oldSlot = mc.player.getInventory().selectedSlot;
    InvUtils.swap2(slot);
    if (rotate) {
        Vec3d rotationPos = new Vec3d(0.0, 0.0, 0.0);
        ((IVec3d) rotationPos).set(blockPos.getY() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5);
        Rotations.rotate(Rotations.getYaw(rotationPos), Rotations.getPitch(rotationPos));
    }
    if (!assertionsDisabled && mc.interactionManager == null)
        throw new AssertionError();
    mc.interactionManager.interactBlock(mc.player, mc.world, Hand.MAIN_HAND, new BlockHitResult(mc.player.getPos(), Direction.UP, blockPos, true));
    InvUtils.swap2(oldSlot);
}
Also used : IVec3d(mathax.client.mixininterface.IVec3d) BlockHitResult(net.minecraft.util.hit.BlockHitResult) Vec3d(net.minecraft.util.math.Vec3d) IVec3d(mathax.client.mixininterface.IVec3d)

Example 8 with IVec3d

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

the class EntitySpeed method onLivingEntityMove.

@EventHandler
private void onLivingEntityMove(LivingEntityMoveEvent event) {
    if (event.entity.getPrimaryPassenger() != mc.player)
        return;
    LivingEntity entity = event.entity;
    if (onlyOnGround.get() && !entity.isOnGround())
        return;
    if (!inWater.get() && entity.isTouchingWater())
        return;
    Vec3d vel = PlayerUtils.getHorizontalVelocity(speed.get());
    ((IVec3d) event.movement).setXZ(vel.x, vel.z);
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) IVec3d(mathax.client.mixininterface.IVec3d) Vec3d(net.minecraft.util.math.Vec3d) IVec3d(mathax.client.mixininterface.IVec3d) EventHandler(mathax.client.eventbus.EventHandler)

Example 9 with IVec3d

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

the class BoatPhase method onBoatMove.

@EventHandler
private void onBoatMove(BoatMoveEvent event) {
    if (mc.player.getVehicle() != null && mc.player.getVehicle().getType().equals(EntityType.BOAT)) {
        if (boat != mc.player.getVehicle()) {
            if (boat != null)
                boat.noClip = false;
            boat = (BoatEntity) mc.player.getVehicle();
        }
    } else
        boat = null;
    if (boat != null) {
        boat.noClip = true;
        if (lockYaw.get())
            boat.setYaw(mc.player.getYaw());
        Vec3d vel;
        if (adjustHorizontalSpeed.get())
            vel = PlayerUtils.getHorizontalVelocity(horizontalSpeed.get());
        else
            vel = boat.getVelocity();
        double velX = vel.x;
        double velY = 0;
        double velZ = vel.z;
        if (verticalControl.get()) {
            if (mc.options.jumpKey.isPressed())
                velY += verticalSpeed.get() / 20;
            if (mc.options.sprintKey.isPressed())
                velY -= verticalSpeed.get() / 20;
            else if (fall.get())
                velY -= fallSpeed.get() / 20;
        } else if (fall.get())
            velY -= fallSpeed.get() / 20;
        ((IVec3d) 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 10 with IVec3d

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

the class GameRendererMixin method updateTargetedEntityInvoke.

@Inject(method = "updateTargetedEntity", at = @At("INVOKE"), cancellable = true)
private void updateTargetedEntityInvoke(float tickDelta, CallbackInfo info) {
    Freecam freecam = Modules.get().get(Freecam.class);
    boolean highwayBuilder = Modules.get().isActive(HighwayBuilder.class);
    if (freecam.isActive() && client.getCameraEntity() != null && !freecamSet) {
        info.cancel();
        Entity camera = client.getCameraEntity();
        double x = camera.getX();
        double y = camera.getY();
        double z = camera.getZ();
        double prevX = camera.prevX;
        double prevY = camera.prevY;
        double prevZ = camera.prevZ;
        float yaw = camera.getYaw();
        float pitch = camera.getPitch();
        float prevYaw = camera.prevYaw;
        float prevPitch = camera.prevPitch;
        ((IVec3d) camera.getPos()).set(freecam.pos.x, freecam.pos.y - camera.getEyeHeight(camera.getPose()), freecam.pos.z);
        camera.prevX = freecam.prevPos.x;
        camera.prevY = freecam.prevPos.y - camera.getEyeHeight(camera.getPose());
        camera.prevZ = freecam.prevPos.z;
        camera.setYaw(freecam.yaw);
        camera.setPitch(freecam.pitch);
        camera.prevYaw = freecam.prevYaw;
        camera.prevPitch = freecam.prevPitch;
        freecamSet = true;
        updateTargetedEntity(tickDelta);
        freecamSet = false;
        ((IVec3d) camera.getPos()).set(x, y, z);
        camera.prevX = prevX;
        camera.prevY = prevY;
        camera.prevZ = prevZ;
        camera.setYaw(yaw);
        camera.setPitch(pitch);
        camera.prevYaw = prevYaw;
        camera.prevPitch = prevPitch;
    } else if (highwayBuilder && client.getCameraEntity() != null && !freecamSet) {
        Entity cameraE = client.getCameraEntity();
        double x = cameraE.getX();
        double y = cameraE.getY();
        double z = cameraE.getZ();
        double prevX = cameraE.prevX;
        double prevY = cameraE.prevY;
        double prevZ = cameraE.prevZ;
        float yaw = cameraE.getYaw();
        float pitch = cameraE.getPitch();
        float prevYaw = cameraE.prevYaw;
        float prevPitch = cameraE.prevPitch;
        if (highwayBuilder) {
            cameraE.setYaw(camera.getYaw());
            cameraE.setPitch(camera.getPitch());
        } else {
            ((IVec3d) cameraE.getPos()).set(x, y, z);
            cameraE.prevX = prevX;
            cameraE.prevY = prevY;
            cameraE.prevZ = prevZ;
            cameraE.setYaw(yaw);
            cameraE.setPitch(pitch);
            cameraE.prevYaw = prevYaw;
            cameraE.prevPitch = prevPitch;
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) IVec3d(mathax.client.mixininterface.IVec3d)

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