EntityDragon invisibility

Discussion in 'Plugin Development' started by CheesyFreezy, May 10, 2015.

Thread Status:
Not open for further replies.
  1. Offline


    Hi hi developers,

    I'm making a plugin where i use a boss bar to send messages to a player. I do this without BarAPI. Everything works, but i just want to ask something. How am i supposed to make my entityenderdragon invisible (PotionEffect, etc.....).

    public void Spawn(final Player player, String msg, int ticks, final int id) {
            WorldServer world = (WorldServer) ((CraftPlayer) player).getHandle().getWorld();
            EntityEnderDragon dragon = new EntityEnderDragon(world);
            double y = player.getLocation().getY() + 125;
            dragon.setLocation(player.getLocation().getX(), y, player.getLocation().getZ(), 0, 0);
            PacketPlayOutSpawnEntityLiving packetSpawn = new PacketPlayOutSpawnEntityLiving(dragon);
            ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetSpawn);
            entity.put(id, dragon);
            if(ticks != 0) {
                Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.instance, new Runnable() {
                    public void run() {
                        PacketPlayOutEntityDestroy packetDestroy = new PacketPlayOutEntityDestroy(entity.get(id).getId());
                        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetDestroy);
                }, ticks);
  2. Offline


  3. dragon.addPotionEffect(PotionEffectType.INVISIBILITY, duration, power); or something like this
  4. Offline


    @Skionz, are you sure?
    @FisheyLP, you can use that for a LivingEntity not for a EntityEnderDragon
  5. Offline


    @CheesyFreezy Why use EnderDragons? afaik they're made up of multiple entities and it just seems impractical to use them. Why not withers? You can prevent them from targeting you with events, and you should be able to use potion effects on them
  6. Invisible


    hmmm... why not just use BarAPI, see a part of their code and write on your way inside your plugin
  7. Offline


    How I do this is by using whither. Currently you can't make ended dragons invisible as the boss bar is done client side so even spawning a real one and disabling its AI And then sending a packet to fake destroy the dragon would remove the boss bar.you used to be able to teleport the dragon underground which is why this used to work, but since 1.7.* you had to be able to see the dragon for the bar to show (this has been fixed in 1.9 future but not for us yet) so do the same stuff but with a whither.

    Whither scan be made invisible by the potion

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 12, 2016
  8. Offline


    What do you mean by this? I can see the bossbar in 1.7 clients without directly seeing the dragon.
  9. Offline


    they place it off far in the distance, however in a flat landscape of when view distance is low you can see the dragon. It's not all 1.7 versions I think it might have started in 1.7.10 not 100% sure. I know dinner bone addressed the issue personally for 1.9, he is also adding multi bar support.
Thread Status:
Not open for further replies.

Share This Page