1.8.8 Creating a EnderDragon AI

Discussion in 'Spigot Plugin Development' started by AcidicViper, Mar 4, 2020.

  1. I haven't been able to find anywhere where someone has already created something similar to or actually created an ender dragon ai to my knowledge.
    I've never used NMS before and I'm trying to use it to start with Pathfinding to edit goals. But, every time I use a reference of this, whereas in most tutorials, with any other entity it works fine. But when extending EntityEnderDragon, "this" isn't a entitycreature.
    Code (Java):

    public CustomDragon(org.bukkit.World world) {
        super(((CraftWorld)world).getHandle());

        EnderDragon craftDragon = (EnderDragon) this.getBukkitEntity();

        craftDragon.setMaxHealth(1000);
        craftDragon.setHealth(1000);

        this.setCustomName(ChatColor.BLACK + "Old Dragon");
        this.setCustomNameVisible(true);

        this.targetSelector.a(0, new PathfinderGoalNearestAttackableTarget<EntityHuman>(this, EntityHuman.class, true));
    }
     
    With this, I have an error underlining the "this", stating Required type: Entity Creature Provided: CustomDragon, where as if I were to extend EntityZombie, or EntitySkeleton, instead of EntityEnderDragon. I don't get the error.
    Any help is appreciated. Thank you.
     
    • Like Like x 1
  2. You can simply remove this and the issue should be fixed (or use craftDragon)
     
  3. Sorry for the late reply! But no this isn't a fix, you can't cast Ender Dragon to EntityCreature. And removing this doesn't resolve the errors either. Thanks for your reply though!
     
  4. EntityEnderDragon doesn't extend from EntityCreature. You'll need to look into the AbstractDragonController and its subclasses - as well as EntityEnderDragon in general - to see how they work, then extend from it and modify as necessary.
    Using NMS in more recent versions isn't as difficult as it used to be thanks to MiniDigger's mapping viewer, but there's nothing pre-1.14.4. I would very much suggest updating for the best support here as well.
     
  5. I have no idea where to start with some of the other stuff but what version would you reccomend I update to? 1.15.2?
     
  6. To stay as up-to-date as possible, I'd recommend 1.15.2, yes. You should usually try to stay on the latest stable version.