[LIB] [1.7] Remote entities - Next generation NPC library [No support]

Discussion in 'Resources' started by kumpelblase2, Nov 10, 2012.

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

    frogawesome

    Good to know, in a future update is it possible to let the npc look like it's sleeping without a bed? i did this but it's only visual and i need to make them have an inventory.
     
  2. Just to be sure, as i haven't really found confirmation of this, but human npc's are unable to move atm right? also InteractBehavior doesn't work either and DesireLookAtNearest only look up and down
     
  3. Offline

    frogawesome

    Human npc's can't move atm yes
     
  4. minimihm98 RE = Remote Entities. Du musst RE als depends eintragen, damit RE vor deinem plugin geladen wird.

    frogawesome Well you can always send the packets yourself with the entity from the handle.

    iamdansker But the interact behavior should work, as well as looking around. The last one definitely works, I've tested this.
     
  5. Offline

    minimihm98

    Danke sehr :D funktioniert *endlich* :d
     
  6. Offline

    SuperOriginal

    How can I classify a normal mob from a RemoteEntity?
     
  7. Hmm, i'v only been able to get it to work on mobs, like all i need to change in order to get it to work, is replace HUMAN with ZOMBIE
    Anyway ill run some more tests on it later today
     
  8. Offline

    frogawesome

    how'd you mean, i am not an expert yet.
     
  9. frogawesome I don't have such thing implemented yet. But you can just send the packets which would let the client believe that it would be how it is.

    supercube101 You mean how you can distinguish a normal bukkit entity from a remote entity? There's a static method in the RemoteEntity class that you can use to do just that.

    iamdansker I tested it on humans and it should work too, I'll look into it later.
     
  10. Offline

    SuperOriginal

  11. Offline

    SuperOriginal

    kumpelblase2 And how do I use that in context of a check is an entity hit is a RemoteEntity? Sorry, i'm very noobish at this.
     
  12. supercube101 Just like you'd normally check for damage and then just add that check for the attacker.
     
  13. Offline

    Buizelfan2

    kumpelblase2
    I'm trying to create a villager shop but I'm not sure how to cancel the trade from popping up the way I have it now the shop opens up for a split second then goes away and the villager trade opens up...
    Code:
    Code:java
    1. public class Mobs extends JavaPlugin implements Listener {
    2.  
    3. public final Logger logger = Logger.getLogger("Minecraft");
    4. public static Mobs main;
    5. private Shop shop;
    6.  
    7. @Override
    8. public void onEnable() {
    9. shop = new Shop(this);
    10. getServer().getPluginManager().registerEvents(this, this);
    11. for (Entity e : Bukkit.getWorld("world").getEntities()) {
    12. if (e instanceof Villager) {
    13. e.remove();
    14. }
    15. }
    16. spawnVillager();
    17. }
    18.  
    19. public void spawnVillager() {
    20. Location loc = new Location(Bukkit.getWorld("world"), 499, 59, 436);
    21. EntityManager manager = RemoteEntities.createManager(this);
    22. final RemoteEntity entity = manager.createEntity(RemoteEntityType.Villager, loc, false);
    23. entity.setSound(EntitySound.RANDOM, null);
    24. entity.setPushable(false);
    25. entity.getBukkitEntity().setCustomName("§4§lShop");
    26. entity.getBukkitEntity().setCustomNameVisible(true);
    27. entity.getMind().addBehaviour(new InteractBehavior(entity) {
    28. @Override
    29. public void onInteract(Player p) {
    30. if (entity.getName() == "§4§lShop") {
    31. shop.show(p);
    32. }
    33. }
    34. });
    35. }
    36. }


    And yes I realize there's no setCancelled in my code that's cause I don't know how to setCancelled with the InteractBehavior..
     
  14. Buizelfan2 You should use the RemoteEntityInteractEvent instead of the behavior as the behavior doesn't intercept the normal reaction of a mob. With the InteractEvent you can do what you could do normally and cancel it to prevent default behavior of a mob.
     
  15. Offline

    Buizelfan2

    So get rid of the getMind() ect.. and just put in a RemoteEntityInteractEvent?

    I figured it out thanks
     
  16. Offline

    SuperOriginal

    kumpelblase2 So would it be like if(pig.isRemoteEntity()){ ? because that doesn't work. Could you provide an example?
     
  17. Offline

    Buizelfan2

    Another quick question is there a way to set the villagers profession or skin i guess?
     
  18. supercube101 No use the method I told you and pass in the entity.

    Buizelfan2 You can use the bukkit methods for that.
     
  19. Offline

    Buizelfan2

    Does that work with remote entities? like it will change the profession of my remote entity villager?
     
  20. Offline

    SuperOriginal

    kumpelblase2 How do you set up the method? Like this?:
    Code:java
    1.  
    2. if(manager.isRemoteEntity(pig)){
    3. pig.getWorld().playSound(pig.getLocation(), Sound.GHAST_SCREAM, 3F, 7F);
    4. return;
    5. }
    6.  


    Because it isn't working.
     
  21. Offline

    Buizelfan2

    How would I do it then? cause theres not .setProfession()
     
  22. Offline

    Buizelfan2

  23. Offline

    Quaro

    Am I only getting this bug in 1.7?
    When i relog near npc, or reload chunk(get far away from entity and come back), npcs duplicating(from one appearing two: one npc, other like simple mob with visible name)?
     
  24. Offline

    frogawesome

    I know players can't be moved but can you make them killable?
     
  25. Offline

    Bart

    Code:java
    1. Villager v = (Villager)remoteentity.getBukkitEntity();
    2. v.setProfession(...)
     
  26. Offline

    frogawesome

    kumpelblase2 Did this dind't really work, guessing that i'm doing something wrong
    Code:
            EntityManager manager = RemoteEntities.createManager(plugin);
           CreateEntityContext c = manager.prepareEntity(RemoteEntityType.Human).asPushable(true).asStationary(false).withName(player.getName()).atLocation(player.getLocation()).withMaxHealth(20.0);
           RemotePlayer re = (RemotePlayer) c.create();
           re.getBukkitEntity().setGameMode(GameMode.SURVIVAL);
    
     
Thread Status:
Not open for further replies.

Share This Page