Questions about Bukkit and NPC's

Discussion in 'Plugin Development' started by Father Of Time, Mar 8, 2012.

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

    Father Of Time

    Good afternoon all,

    I have a project that has created a need for NPCs. Now I know NPC’s are nothing new in the Bukkit community, but I’m confused about which option to take. At this time I’m aware of two different NPC options, org.bukkit.entity.NPC and NpcSpawner lib.

    Now I would prefer to stick with anything that already exist within Bukkit, but my understanding from when I last looked into this was that Bukkit does not have built in NPC functionality and that to add NPC’s to the world you would need to implement the NPCSpawner library.

    However, as I was browsing the Bukkit NPC java docs it appears as if this class is fully developed (unless it’s just inheriting a bunch of stuff ). So I’m looking to know:

    1) Is the org.bukkit.entity.NPC class functional?
    2) Can you rename an NPC.
    3) Can you change the skin of an NPC.
    4) Can you control the actions of an NPC (particularly making them stay in a single spot)
    5) Can you trigger events on these NPCs just like other entities ( onEntityInteract )

    If anyone can assist by shedding some light on my confusion I would be extremely appreciative.

    Thank you for your time, have a wonderful day!

    As I look a little deeper I can see the following:

    NPC extends Creature:
    adds no new functions, appears to be an empty class

    Creature extends LivingEntity
    adds setTarget and getTarget to allow you to set what a living entity is targeting and retrieve what they are targeting

    So if the ability to alter the skin and name isn't inside the NPC class itself then I highly doubt it's anywhere else, so does this mean that all instances of NPC will appear as "steve" (I would test this myself but I am at work)?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 24, 2016
  2. Offline


    I think the NPC from Bukkit represents the Villagers, isn't it?
  3. Offline

    Father Of Time

    Not quite, they are two different classes, but the Villager inherits from NPC:

    public interface Villager extends NPC
    You raise a good point though, I'm off to look at the Villagers class a bit.

    *runs off flapping his arms like an airplane*
  4. Offline


    Bukkit does not have a way to spawn an NPC. If you look at the World.spawn method, you'll see that it isn't there. There also isn't an option for it in the EntityType enum.
  5. Offline


    OK. :D

    Because I searched de Java Docs too and I don't find anything relationed to change skin, name, etc... and NPC only is inherited from Villager and extends Creature, LivingEntity and Entity, so I think it's hard to have something like that.
  6. Offline

    Father Of Time

    Nothing that useful, just an enum for profession:

    It would be so helpful if we could either give them a custom profession or change their name.

    Bummer, that is what I feared... I was just hoping this was something that was no longer true; after all, lately they have been on a roll with adding in new highly demanded api's... Oh well, thanks guys!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 24, 2016
Thread Status:
Not open for further replies.

Share This Page