[LIB] CitizensAPI - Create NPCs quickly and easily [MC 1.8.x]

Discussion in 'Resources' started by fullwall, Feb 6, 2013.

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

    LCastr0

    fullwall How can I make an NPC rotate?
     
  2. Offline

    fullwall

    LCastr0 - change their location yaw/pitch with bukkit. You can also set the head yaw using NPC.
    TwerkinCraft - try registering for an NPCLeft/RightClickEvent instead.
     
  3. Offline

    LCastr0

    I know it, but how can I make it look to the nearest player, like when you do /npc rotate?
     
  4. Offline

    Ghost_Dev

    fullwall could you add an option in the config like api-only: false. And if you enable it Citizens itself disable all normal functions commands etc. and only provide an api for other plugins?
     
  5. Offline

    fullwall

    LCastr0 - npc.faceLocation
    Ghost_Dev - can you explain more of the motivation behind this please?
     
  6. Offline

    Ghost_Dev

    So I have seen multiple Npc-Libarys on the Forums. The Problem was that they are not maintained.

    (http://dev.bukkit.org/bukkit-plugins/controllable-mobs-api/,
    http://forums.bukkit.org/threads/li...ext-generation-npc-library-no-support.110304/)

    Then I found Citizens. The Problem was I only wanted to use and Api not a whole Plugin which includes other functions I don't need. Futuremore I got in love with Citizens-Api, which was easy to use/understand and the Pathfinding System.

    But because it was a Plugin not an Api I tried to create custom Entitys via NMS without Api.
    I have realized that's tiring to find out what each Function does.

    So I hoped you could add an Option in your Plugin which disables all function, a normal User needs, and only let the things activated to it as a Api. Then this would the the awesomest Npc-Api I've ever seen. Easy-Api, beautifully Pathfinder aaaand I am sure you continue to maintain this Lib. ;)
     
  7. Offline

    LCastr0

    But it would be checked whenever a player gets close?
     
  8. Offline

    fullwall

  9. Offline

    PizzaPixel

    I used this but when i started my server it didnt spawn the npcs.
    I dont Have any errors in my console.

    Here is my code
    Code:java
    1. package jff.lol;
    2.  
    3.  
    4. import java.util.logging.Level;
    5.  
    6. import net.citizensnpcs.api.CitizensAPI;
    7. import net.citizensnpcs.api.npc.NPC;
    8. import net.citizensnpcs.api.npc.NPCRegistry;
    9.  
    10. import org.bukkit.Bukkit;
    11. import org.bukkit.ChatColor;
    12. import org.bukkit.entity.EntityType;
    13. import org.bukkit.event.Listener;
    14. import org.bukkit.plugin.java.JavaPlugin;
    15.  
    16. public class AJff extends JavaPlugin implements Listener{
    17.  
    18. public void onEnable()
    19. {
    20. if ((getServer().getPluginManager().getPlugin("Citizens") == null) || (!getServer().getPluginManager().getPlugin("Citizens").isEnabled()))
    21. {
    22. getLogger().log(Level.SEVERE, "Citizens 2.0 not found or not enabled");
    23. getServer().getPluginManager().disablePlugin(this);
    24. return;
    25. }
    26. Bukkit.getServer().getPluginManager().registerEvents(this, this);
    27.  
    28. }
    29.  
    30.  
    31.  
    32. @SuppressWarnings("deprecation")
    33. public void NPCspawn1()
    34. {
    35. NPCRegistry registry = CitizensAPI.getNPCRegistry();
    36. NPC Mac = registry.createNPC(EntityType.WOLF, ChatColor.BLACK + "Woof!");
    37. Mac.spawn(Bukkit.getWorlds().get(0).getSpawnLocation());
    38. Mac.setProtected(true);
    39. Mac.getBukkitEntity().setCustomNameVisible(true);
    40. Mac.getNavigator().setTarget(Bukkit.getWorlds().get(0).getSpawnLocation());
    41.  
    42. }
    43. }
    44.  
    45.  
    46.  
    47.  
    48.  
     
  10. Offline

    fullwall

    PizzaPixel - where do you actually call NPCspawn1()?
     
  11. Offline

    Shadow_Parallax

    Any info on when a dev build will be available? Or how to bypass the version check, I understand this can cause instability but, I can't really downgrade my Bukkit to 1.7.2 or whatever the latest version is because my system relies on the new UUID system introduced with 1.7.8 it would require me to go through 700+ lines of code ;-;
     
  12. Offline

    fullwall

  13. Offline

    Shadow_Parallax

    fullwall Thanks! I completely forgot Citizens has a config file ._.
     
  14. Offline

    silthus

  15. Offline

    Onlineids

    Is there a way to make npcs react to players so that when a player crouches or jumps near them they do the same.
     
  16. Offline

    fullwall

    Onlineids - that's something you'll need to do with repeating tasks in your plugin or by implementing the run() method in Trait.
     
  17. Offline

    Onlineids

    is there a way to make npcs crouch/jump?
     
  18. Offline

    fullwall

    Onlineids - player.setSneaking(true/false) and entity.setVelocity(entity.getVelocity().add(0,0.6,0));
     
  19. Offline

    iWareWolf

    Is it possible to make the NPC punch?
     
  20. Offline

    ItsOneAndTwo

    How can I set villagers profession with the API?
     
  21. Offline

    fullwall

    ItsOneAndTwo - use Bukkit's API
    iWareWolf - yes, it will require you to use NMS however. If you depend on Citizens you can use the PlayerAnimation class.
     
  22. Offline

    guitargun

    fullwall is there a way to get the path that the npc is going to make to get from a to b with all the coords or not?
     
  23. Offline

    fullwall

    guitargun - there is if you use the Citizens pathfinder (useNewFinder).
     
  24. Offline

    guitargun

    fullwall

    do you have a code example for that. cant figure it out sorry. I can just use the npc.getNavigator().setTarget(pointb) right?
     
  25. Offline

    silthus

  26. Offline

    guitargun

  27. Offline

    fullwall

    guitargun - yep. There's no API for getting the path directly yet unless you pathfind manually. Do you want an API for that?
    silthus - dead link. I can try to reproduce.
     
  28. Offline

    guitargun


    I would like to have a api for that. my A* algorithm isn't that good
     
  29. Offline

    silthus

  30. Offline

    fullwall

    guitargun - I mean, there's API for pathfinding, but you can't get the path when you use npc.getNavigator().setTarget
     
Thread Status:
Not open for further replies.

Share This Page