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);
}
}
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;
}
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;
}
}
Aggregations