Search in sources :

Example 56 with Vec3D

use of net.minecraft.server.v1_14_R1.Vec3D in project MechanicsMain by WeaponMechanics.

the class FakeEntity_1_14_R1 method show.

public void show() {
    // Construct the packets out of the loop to save resources, they will
    // be the same for each Player.
    Packet<?> spawn = type.isAlive() ? new PacketPlayOutSpawnEntityLiving((EntityLiving) entity) : new PacketPlayOutSpawnEntity(entity, type == EntityType.FALLING_BLOCK ? Block.getCombinedId(block) : 0);
    PacketPlayOutEntityMetadata meta = new PacketPlayOutEntityMetadata(cache, entity.getDataWatcher(), true);
    PacketPlayOutEntityHeadRotation head = new PacketPlayOutEntityHeadRotation(entity, convertYaw(getYaw()));
    PacketPlayOutEntityLook look = new PacketPlayOutEntityLook(cache, convertYaw(getYaw()), convertPitch(getPitch()), false);
    PacketPlayOutEntityVelocity velocity = new PacketPlayOutEntityVelocity(cache, new Vec3D(motion.getX(), motion.getY(), motion.getZ()));
    for (Player temp : DistanceUtil.getPlayersInRange(location)) {
        PlayerConnection connection = ((CraftPlayer) temp).getHandle().playerConnection;
        if (connections.contains(connection)) {
            continue;
        }
        connection.sendPacket(spawn);
        connection.sendPacket(meta);
        connection.sendPacket(head);
        connection.sendPacket(velocity);
        connection.sendPacket(look);
        PacketPlayOutEntityEquipment[] equipment = getEquipmentPacket();
        if (equipment != null) {
            for (PacketPlayOutEntityEquipment packet : equipment) {
                connection.sendPacket(packet);
            }
        }
        connections.add(connection);
    }
}
Also used : Player(org.bukkit.entity.Player) CraftPlayer(org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer) PacketPlayOutEntityLook(net.minecraft.server.v1_14_R1.PacketPlayOutEntity.PacketPlayOutEntityLook)

Example 57 with Vec3D

use of net.minecraft.server.v1_14_R1.Vec3D in project BigDoors by PimvanderLoos.

the class CustomCraftFallingBlock_V1_15_R1 method setVelocity.

@Override
public void setVelocity(Vector3Dd vector) {
    entity.setMot(new Vec3D(vector.x(), vector.y(), vector.z()));
    entity.velocityChanged = true;
}
Also used : Vec3D(net.minecraft.server.v1_15_R1.Vec3D)

Example 58 with Vec3D

use of net.minecraft.server.v1_14_R1.Vec3D in project custom-items-gradle by knokko.

the class EntityLineIntersection method distanceToStart.

public static double distanceToStart(Entity entity, Location lineStartLocation, Vector direction, double safeUpperBound) {
    net.minecraft.server.v1_12_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
    Vec3D lineStart = new Vec3D(lineStartLocation.getX(), lineStartLocation.getY(), lineStartLocation.getZ());
    Vec3D lineEnd = new Vec3D(lineStartLocation.getX() + safeUpperBound * direction.getX(), lineStartLocation.getY() + safeUpperBound * direction.getY(), lineStartLocation.getZ() + safeUpperBound * direction.getZ());
    MovingObjectPosition intersection = nmsEntity.getBoundingBox().b(lineStart, lineEnd);
    if (intersection != null) {
        return Math.sqrt(intersection.pos.distanceSquared(lineStart));
    } else {
        return Double.POSITIVE_INFINITY;
    }
}
Also used : MovingObjectPosition(net.minecraft.server.v1_12_R1.MovingObjectPosition) CraftEntity(org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity) Vec3D(net.minecraft.server.v1_12_R1.Vec3D)

Aggregations

Vec3D (net.minecraft.server.v1_16_R3.Vec3D)11 Vec3D (net.minecraft.server.v1_15_R1.Vec3D)10 Vec3D (net.minecraft.server.v1_14_R1.Vec3D)9 Vec3D (net.minecraft.server.v1_12_R1.Vec3D)7 Vec3D (net.minecraft.server.v1_10_R1.Vec3D)5 Vec3D (net.minecraft.server.v1_11_R1.Vec3D)5 Vec3D (net.minecraft.server.v1_8_R3.Vec3D)4 Gravity (net.citizensnpcs.trait.Gravity)3 BlockPosition (net.minecraft.server.v1_14_R1.BlockPosition)3 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)2 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)2 AxisAlignedBB (net.minecraft.server.v1_12_R1.AxisAlignedBB)2 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)2 MovingObjectPosition (net.minecraft.server.v1_12_R1.MovingObjectPosition)2 PathPoint (net.minecraft.server.v1_14_R1.PathPoint)2 AxisAlignedBB (net.minecraft.server.v1_16_R3.AxisAlignedBB)2 BaseBlockPosition (net.minecraft.server.v1_16_R3.BaseBlockPosition)2 BlockPosition (net.minecraft.server.v1_16_R3.BlockPosition)2 PathPoint (net.minecraft.server.v1_16_R3.PathPoint)2 AxisAlignedBB (net.minecraft.server.v1_8_R3.AxisAlignedBB)2