Search in sources :

Example 1 with PacketPlayOutSpawnEntityLiving

use of net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving in project FireAPI by FireBlade-Serv.

the class FireBossBar method gen.

public void gen(String title) {
    EntityEnderDragon ew = new EntityEnderDragon(((CraftWorld) this.p.getWorld()).getHandle());
    Location loc = this.p.getLocation();
    ew.setInvisible(true);
    ew.setLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getPitch(), loc.getYaw());
    ew.setCustomName(title);
    PacketPlayOutSpawnEntityLiving pel = new PacketPlayOutSpawnEntityLiving(ew);
    ((CraftPlayer) this.p).getHandle().playerConnection.sendPacket(pel);
}
Also used : EntityEnderDragon(net.minecraft.server.v1_8_R3.EntityEnderDragon) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving) CraftPlayer(org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer) Location(org.bukkit.Location)

Example 2 with PacketPlayOutSpawnEntityLiving

use of net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving in project Denizen-For-Bukkit by DenizenScript.

the class BossBar_v1_8_R3 method showBossBar.

public static void showBossBar(Player player, String text, int health) {
    wither.setCustomName(text);
    wither.setHealth(health);
    Location location = player.getLocation().clone();
    location.add(player.getLocation().getDirection().multiply(30));
    wither.setPosition(location.getX(), location.getY(), location.getZ());
    PacketHelper_v1_8_R3.sendPacket(player, new PacketPlayOutSpawnEntityLiving(wither));
    hasHealthBar.put(player.getName(), true);
    playersWithHealthBar.add(player);
}
Also used : PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving) Location(org.bukkit.Location)

Aggregations

PacketPlayOutSpawnEntityLiving (net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving)2 Location (org.bukkit.Location)2 EntityEnderDragon (net.minecraft.server.v1_8_R3.EntityEnderDragon)1 CraftPlayer (org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer)1