Search in sources :

Example 1 with CraftEnderDragon

use of org.bukkit.craftbukkit.v1_17_R1.entity.CraftEnderDragon in project UltraCosmetics by iSach.

the class EntityUtil method moveDragon.

@Override
public void moveDragon(Player player, Vector vector, org.bukkit.entity.Entity entity) {
    EnderDragon ec = ((CraftEnderDragon) entity).getHandle();
    ec.hurtTime = -1;
    ec.setXRot(player.getLocation().getPitch());
    ec.setYRot(player.getLocation().getYaw() - 180);
    float yaw = player.getPlayer().getLocation().getYaw();
    double angleInRadians = toRadians(-yaw);
    double x = sin(angleInRadians);
    double z = cos(angleInRadians);
    Vector v = ec.getBukkitEntity().getLocation().getDirection();
    ec.move(MoverType.SELF, new Vec3(x, v.getY(), z));
}
Also used : EnderDragon(net.minecraft.world.entity.boss.enderdragon.EnderDragon) CraftEnderDragon(org.bukkit.craftbukkit.v1_18_R2.entity.CraftEnderDragon) CraftEnderDragon(org.bukkit.craftbukkit.v1_18_R2.entity.CraftEnderDragon) Vec3(net.minecraft.world.phys.Vec3) Vector(org.bukkit.util.Vector)

Example 2 with CraftEnderDragon

use of org.bukkit.craftbukkit.v1_17_R1.entity.CraftEnderDragon in project UltraCosmetics by iSach.

the class EntityUtil method moveDragon.

@Override
public void moveDragon(Player player, Vector vector, org.bukkit.entity.Entity entity) {
    EnderDragon ec = ((CraftEnderDragon) entity).getHandle();
    ec.hurtTime = -1;
    ec.setXRot(player.getLocation().getPitch());
    ec.setYRot(player.getLocation().getYaw() - 180);
    float yaw = player.getPlayer().getLocation().getYaw();
    double angleInRadians = toRadians(-yaw);
    double x = sin(angleInRadians);
    double z = cos(angleInRadians);
    Vector v = ec.getBukkitEntity().getLocation().getDirection();
    ec.move(MoverType.SELF, new Vec3(x, v.getY(), z));
}
Also used : CraftEnderDragon(org.bukkit.craftbukkit.v1_17_R1.entity.CraftEnderDragon) EnderDragon(net.minecraft.world.entity.boss.enderdragon.EnderDragon) CraftEnderDragon(org.bukkit.craftbukkit.v1_17_R1.entity.CraftEnderDragon) Vec3(net.minecraft.world.phys.Vec3) Vector(org.bukkit.util.Vector)

Aggregations

EnderDragon (net.minecraft.world.entity.boss.enderdragon.EnderDragon)2 Vec3 (net.minecraft.world.phys.Vec3)2 Vector (org.bukkit.util.Vector)2 CraftEnderDragon (org.bukkit.craftbukkit.v1_17_R1.entity.CraftEnderDragon)1 CraftEnderDragon (org.bukkit.craftbukkit.v1_18_R2.entity.CraftEnderDragon)1