1.14.4 Spawning custom entity

Discussion in 'Spigot Plugin Development' started by palamud, Jan 9, 2020.

  1. Hello everyone i am trying to spawn my custom zombie with different pathfindings. i have a class that extends EntityZombie where i will make changes on my zombie. How can i make a zombie use my class instead of originial one?
  2. You don't, you want to be using composition rather then inheritance.
  3. In this case, no. Inheritance is the right way to go when it comes to custom Entity behavioural description.
    In my opinion, you can use World#spawn(Location, Class) and insert your custom Zombie class (as CustomZombie.class) into this. If this doesn't work you might need a handle to the NMS-world...
  4. In that case how do you know the difference between your custom Zombie and a normal Zombie (assuming you are not overriding all Zombie spawns)? You will need to do this at some point, at least at chunk unloading time as later when the chunk is reload you will need to spawn your custom Zombie again as the server doesn't know about the custom Zombie class.
  5. Entity#getType(), instanceof,...
    You can register custom entities in the Minecraft registry. That way the server knows who is who.
  6. Due this fact the command /minecraft:summon knows the entity as well. Am I right?
  7. actually i was struggling with this for days but i gave up unless someone gives proper help :)