Spawn custom entity

Discussion in 'Plugin Development' started by thematdev, Nov 12, 2017.

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

    thematdev

    I want to spawn my entity:
    Code:
    public class TrenNpc extends EntityVillager implements Listener
    But how can i do it? Please help, because
    Code:
    w.spawnEntity(arg0, arg1);
    doesn't support custom entity types.
     
  2. Offline

    MightyOne

    @thematdev world.addEntity(new TrenNpc()) was the way it workied for me.
    I also made a custom entity type of my custome entity class and added it to the EntityTypes class.
    But I dont know how the rest of your code looks, what you have already done so far.
     
    Matroxko likes this.
  3. Offline

    thematdev

    So, i'll try. Maybe help...
     
  4. Offline

    Pandi.O

    I don't know if you want to use Citizens, but you can also use the Citizens api to create more complex npc's
     
  5. Offline

    thematdev

    Hmm, how can I set coords for this NPC & how can i "freese" it(he can't move, but there is not any barriers or other block. Other things(quests & onClick event i have added).

    Thx for help.
    (solved):
    PHP:
    EntityVillager en =  (EntityVillagergetServer().getWorld("world").spawnEntity(new Location(getServer().getWorld("world"), 000), EntityType.VILLAGER);
     
    Last edited: Dec 13, 2017
  6. Offline

    AdamDev

    @thematdev
    If your problem has been solved, please mark your thread as solved.
     
Thread Status:
Not open for further replies.

Share This Page