[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

    Draesia

    kumpelblase2 Thanks so much I finally got it working, the only problem is the lag, I don't understand what you mean by
    I am expected to have up to ~130 RemoteEntitites at once, do you have any good tips for controlling large amounts of RemoteEntitites, also how would you go around recycling a RemoteEntity?

    EDIT: I have tried reducing the lag and it seems that my Desire "MoveToLocations" is the culprit, however it is almost exactly the same as 'MoveToLocation' however it passes a List<Location> instead of a Location, I feel it might be because of the constant Pathfinding it has to do, and the distance between each Location is ~ 40 Blocks. Is there any way to reuse the paths? All ~130 entities which I am using all follow 1 of 6 paths.
     
  2. Offline

    Jamboozlez

    Error log:
    Code:
    [SEVERE] Could not load 'plugins\TourGuide.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: de.kumpelblase2.remoteentities.exceptions.PluginNotEnabledException: RemoteEntities needs to be enable in order to use this operation
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:182)
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305)
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230)
        at org.bukkit.craftbukkit.v1_5_R3.CraftServer.loadPlugins(CraftServer.java:239)
        at org.bukkit.craftbukkit.v1_5_R3.CraftServer.reload(CraftServer.java:603)
        at org.bukkit.Bukkit.reload(Bukkit.java:185)
        at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:23)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:189)
        at org.bukkit.craftbukkit.v1_5_R3.CraftServer.dispatchCommand(CraftServer.java:523)
        at org.bukkit.craftbukkit.v1_5_R3.CraftServer.dispatchServerCommand(CraftServer.java:512)
        at net.minecraft.server.v1_5_R3.DedicatedServer.an(DedicatedServer.java:262)
        at net.minecraft.server.v1_5_R3.DedicatedServer.r(DedicatedServer.java:227)
        at net.minecraft.server.v1_5_R3.MinecraftServer.q(MinecraftServer.java:477)
        at net.minecraft.server.v1_5_R3.MinecraftServer.run(MinecraftServer.java:410)
        at net.minecraft.server.v1_5_R3.ThreadServerApplication.run(SourceFile:573)
    Caused by: de.kumpelblase2.remoteentities.exceptions.PluginNotEnabledException: RemoteEntities needs to be enable in order to use this operation
        at de.kumpelblase2.remoteentities.RemoteEntities.createManager(RemoteEntities.java:48)
        at play.hazecraft.net.jamboozlez.tourguide.TourGuide.<init>(TourGuide.java:21)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:178)
        ... 14 more
    MainClass:
    Code:java
    1. package play.hazecraft.net.jamboozlez.tourguide;
    2.  
    3. import org.bukkit.Bukkit;
    4. import org.bukkit.Location;
    5. import org.bukkit.entity.Player;
    6. import org.bukkit.event.EventHandler;
    7. import org.bukkit.event.Listener;
    8. import org.bukkit.event.player.PlayerJoinEvent;
    9. import org.bukkit.plugin.java.JavaPlugin;
    10.  
    11. import de.kumpelblase2.remoteentities.EntityManager;
    12. import de.kumpelblase2.remoteentities.RemoteEntities;
    13. import de.kumpelblase2.remoteentities.api.RemoteEntity;
    14. import de.kumpelblase2.remoteentities.api.RemoteEntityType;
    15. import de.kumpelblase2.remoteentities.api.thinking.InteractBehavior;
    16. import de.kumpelblase2.remoteentities.api.thinking.goals.DesireLookAtNearest;
    17.  
    18. public final class TourGuide extends JavaPlugin implements Listener {
    19.  
    20. //First we need an instance of the manager, which keeps track of your entities
    21. EntityManager manager = RemoteEntities.createManager(this);
    22.  
    23. @Override
    24. public void onEnable() {
    25. getLogger().info("TourGuide was enabled!");
    26. Bukkit.getPluginManager().registerEvents(this, this);
    27. this.manager = RemoteEntities.createManager(this);
    28. }
    29.  
    30. public void createNPC(Location location) {
    31. //Using the manager we create a new human npc at the spawn location, but we won't setup the standard desires/goals
    32. RemoteEntity entity = manager.createNamedEntity(RemoteEntityType.Human, location, "Tour Guide", false);
    33. //We don't want him to move so we make him stationary
    34. entity.setStationary(true);
    35. //Now we want him to look at the nearest player. This desire has a priority of 1 (the higher the better).
    36. //Since we don't have any other desires 1 is totally fine.
    37. //Note that when you have more than one desire with the same priority, both could get executed, but they'd need a different type (e.g. looking and moving)
    38. //This does not get executed all the time. It might just get executed but he might take a break for 2 seconds after that. It's random.
    39. entity.getMind().addMovementDesire(new DesireLookAtNearest(entity, Player.class, 8F), 1);
    40. //When a player interacts with him, we want him to tell something to the player.
    41. //I make an anonymous class here, but you can create a whole new class if you want to
    42. //but it needs to extend InteractBehaviour
    43. entity.getMind().addBehaviour(new InteractBehavior(entity)
    44. {
    45. @Override
    46. public void onInteract(Player inPlayer)
    47. {
    48. inPlayer.sendMessage("Stop hitting me!");
    49. }
    50. });
    51. }
    52.  
    53. @Override
    54. public void onDisable() {
    55. getLogger().info("TourGuide was disabled!");
    56. }
    57.  
    58. @EventHandler
    59. public void onJoin(PlayerJoinEvent inEvent) throws Exception
    60. {
    61. createNPC(inEvent.getPlayer().getLocation());
    62. inEvent.getPlayer().sendMessage("Spawned TourGuide next to you (" + inEvent.getPlayer() + ")");
    63. }
    64. }
    65.  


    plugins.yml:
    Code:
    name: TourGuide
    main: play.hazecraft.net.jamboozlez.tourguide.TourGuide
    version: 1.0
    description: TourGuide for when there is no [Officer]s around.
    author: Jamboozlez - Contact me on Minecraft Server play.hazecraft.net(24hr) or jamboozlez.no-ip.org(Not 24hr)
    depend: [RemoteEntities]
    I understand it's saying it needs to be enabled, but I haven't done anything to disable it.
     
  3. Aqua hm interesting.

    Jatoc Well, you can just create your own desire to also support world guard regions if you wish.

    Draesia I haven't tried re-using nms-paths. It probably works, but I can't guarantee it.

    Jamboozlez In line 21 RemoteEntities isn't enabled yet, you can first use it in your on enable like you already do as well. If you just declare the manager variable without creating a manager at that point it will be fine.
     
  4. Offline

    Draesia

    kumpelblase2 how do you think I should go around re-using nms-paths? Could you give me a quick example? I've been working on this for 3 days now with no prevail
     
  5. Offline

    TomFromCollege

    Lovely library I must say!
    I'm having a few problems with creating "Pets" so to speak, literally removing all behaviors and adding a movement desire to follow their owner:
    Code:java
    1. entity.getMind().clearBehaviours();
    2. entity.getMind().clearMovementDesires();
    3. entity.getMind().clearTargetingDesires();
    4. entity.getMind().addMovementDesire(new DesireFollowSpecific(entity, p.getOwner(), 3, 10), 10;)

    For some reason, all of the pets move incredibly slow!
    In the case of the Bat for example, it will fly around madly until it reaches the max limit and jumps back to me.
    Increasing the speed of the entities causes them to become mad and 1 movement tick ends up causing them to go miles infront of where I am.

    Sorry for being a pain, and once again, thanks for the beautifully crafted library, it's not often you see them with such functionality!
     
  6. Offline

    Draesia

    TomFromCollege use entity.setSpeed(0.3F) to set it to it's default speed.
     
  7. Draesia Well, I'll give you one way, but there might be others to achieve the same. So basically what you're trying to do is to let minecraft generate you a PathEntity instance which you can re-apply to all mobs. This is the theory, I'm still not sure if this is actually possible to do.
    You can do that by calling world.a(Entity, int, int, int, int, boolean, boolean, boolean, boolean) which will generate the path for you (you can also look at RemoteBaseEntity#144). Save that PathEntity and just use baseentity.moveWithPath(path, speed) and it will use the path you gave it. From what I've seen, there shouldn't be any issues with reusing it, but I wasn't able to test it myself yet. Hope this helps you.
     
  8. Offline

    Draesia

    kumpelblase2 Thanks, I will get onto attempting this now, I will post back later with what I find, also do you know if there is a range for world.a() and if so, what is it?

    Also I found a bug, in my experience it's impossible to spawn a RemoteWither.

    I haven't been able to get reusing PathEntities to work, here is what I have done.

    I created a new desire for the RemoteEntities

    Code:java
    1. public class DesireMoveAlongPath extends DesireBase {
    2.  
    3. private PathEntity path;
    4.  
    5. public DesireMoveAlongPath(RemoteEntity inEntity, PathEntity path) {
    6. super(inEntity);
    7. this.path = path;
    8. this.m_type = DesireType.FULL_CONCENTRATION;
    9. }
    10.  
    11. @Override
    12. public boolean canContinue() {
    13. return true;
    14. }
    15.  
    16. @Override
    17. public boolean shouldExecute() {
    18. return true;
    19. }
    20.  
    21. public void startExecuting() {
    22. this.movePath(path, 0.3F);
    23. }
    24.  
    25. @Override
    26. public boolean update() {
    27. this.movePath(path, 0.3F);
    28. return true;
    29. }
    30.  
    31. }


    This should simply make them walk along the path given.

    Here is how I am getting and passing the path.

    Code:java
    1. RemoteEntity re = spawnMob(RemoteEntityType.Zombie, position.get(0));
    2. Location inLocation = position.get(1);
    3. path = re.getHandle().world.a(re.getHandle(), MathHelper.floor(inLocation.getX()), (int) inLocation.getY(), MathHelper.floor(inLocation.getZ()), 32, true, false, false, true);
    4. re.getMind().addMovementDesire(new DesireMoveAlongPath(re, path), 1);


    The Zombie spawns in, but stands and remains still.

    Do you know any way to make it possible? About 3-4 weeks of work is lost if I can't reuse nms PathEntities or if I can't find another way to stop the lag of having 140 RemoteEntitites move to a location.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  9. Draesia Just looked at the source again, I totally overlooked something. Unlike I do, the current point of the path is saved in the pathentity itself. Thus when you set it for other ones it will only reference that instance and will keep the path counter. So you'd have to clone it, but since there's not method for getting the points you sadly have to use reflection. It's the a field in PathEntity which is an array of PathPoints if that helps.
    If feel really sorry for not being able to provide my own pathfinding yet which would make it way easier :(
     
  10. Offline

    Draesia

    kumpelblase2 Do you have Skype or anything so I can contact you easier? If so, PM me please :)

    And I will keep trying to get it working, thanks for being so persistent.
     
  11. Offline

    rmb938

    I am trying to follow the persistence example found here https://github.com/kumpelblase2/Remote-Entities/blob/master/examples/Persistence/ExampleMain.java

    However I keep getting this error:

    Code:
    java.lang.NullPointerException
        at de.kumpelblase2.remoteentities.persistence.serializers.YMLSerializer.loadData(YMLSerializer.java:60)
        at de.kumpelblase2.remoteentities.EntityManager.loadEntities(EntityManager.java:540)
        at com.mineempire.base.Base.onEnable(Base.java:67)
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457)
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
        at org.bukkit.craftbukkit.v1_5_R3.CraftServer.loadPlugin(CraftServer.java:282)
        at org.bukkit.craftbukkit.v1_5_R3.CraftServer.enablePlugins(CraftServer.java:264)
        at net.minecraft.server.v1_5_R3.MinecraftServer.j(MinecraftServer.java:304)
        at net.minecraft.server.v1_5_R3.MinecraftServer.e(MinecraftServer.java:283)
        at net.minecraft.server.v1_5_R3.MinecraftServer.a(MinecraftServer.java:243)
        at net.minecraft.server.v1_5_R3.DedicatedServer.init(DedicatedServer.java:151)
        at net.minecraft.server.v1_5_R3.MinecraftServer.run(MinecraftServer.java:382)
        at net.minecraft.server.v1_5_R3.ThreadServerApplication.run(SourceFile:573)
    and this is my code

    Code:
    entityManager = RemoteEntities.createManager(this);
            entityManager.setEntitySerializer(new YMLSerializer(this));
            entityManager.loadEntities();
     
     
            RemoteEntity entity = entityManager.createEntity(RemoteEntityType.Zombie, Bukkit.getWorld("world").getSpawnLocation());
            entity.save();
            entityManager.saveEntities();
    I tried this in 1.6 and the latest 1.7 snapshot.

    Also is it possible to add an event when a npc is created not just spawned?
     
  12. Offline

    Draesia

    kumpelblase2 Hey, I was looking though the source code and I noticed the path finding code that you do have, what is wrong with it, why did you say it's not finished?

    kumpelblase2 after trying to work this whole think out, I realised that when I try to get a PathEntity, it always equals null, I've tried the method you told me and I found another inside .getNavigator().

    Why is this returning null, how can I make it not return null?

    kumpelblase2 Aha, I got it! I successfully reused a NMS PathEntity (kinda)
    I'll post all my code ect if anyone wants it

    Also, kumpelblase2, for some reason, I can't spawn a RemoteEntity with an x value of less than 255..
    Well I can spawn it, but it just stands there, I cannot punch it, and I cannot give it armour ect (Although I can give it a name)
    I don't think it's to do with my plugin or any others.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  13. Is there an easy way to equip a NPC with Armor, Weapons and so on? Or do I have to add some methods like that myself via Commands or Interaction to make it work?

    Btw. awesome libary, we are gonna switch over from Citizens save and load horror to this ^^.
     
  14. rmb938 Fixed the issue in the latest snapshot and also added a entity create event.

    Draesia I will check that.

    silthus Just use the bukkit equipment, it'll work just fine.
     
  15. Offline

    mike0631

    How do I let an entity do more damage?
     
  16. Offline

    ICodeMaster

    So i have a question about your awesome library. I need a "flyable dragon" for a plugin. So i have the standard setup you have on the forums for now. I removed the stuff i wouldn't need like the looking and talking.
    I added this bit though:
    Code:java
    1. Collection behave = dragon.getMind().getBehaviours();
    2. dragon.getMind().getBehaviours().removeAll(behave);

    So wouldn't take make it stop trying to kill people?

    Then i have a move event:
    Code:
    public static void playerRide(Player p, PlayerMoveEvent evt){
            p = evt.getPlayer();
            //if(p.getVehicle().equals(dragon)){
                Location pTo = evt.getTo().add(0, -10, 0);
                if(evt.getTo().subtract(0, 2, 0).getBlock().isEmpty()){
                p.sendMessage("Dragon");
                dragon.setStationary(false);
                dragon.move(pTo);
                }
            //}
        }
    This works with most of the flying and non flying mobs i tested. Question is it doesn't work with the enderdragon and it LAGS LIKE HIGH HELL! Is there a reason for this? Also another quick question can you cast this entity to and Entity object to apply names and such? Like so:

    Code:
    Entity dragonE = dragon;
    //based off code above
    dragonE.setCustomName("My Dragon!");
     
  17. Offline

    JeroenV

    I've been using this api for quite some time now and I needed to create a desire where zombies with a certain faction as name would attack players that are of an enemy faction. However it just ends up not doing anything, here's my code:

    Code:
    package CustomDesires;
     
    import java.util.*;
     
    import org.bukkit.entity.Player;
     
    import Resources.Factions.FactionsMain;
     
    import net.minecraft.server.v1_5_R3.*;
    import de.kumpelblase2.remoteentities.api.RemoteEntity;
    import de.kumpelblase2.remoteentities.api.thinking.DesireType;
    import de.kumpelblase2.remoteentities.api.thinking.goals.DesireTargetBase;
    import de.kumpelblase2.remoteentities.persistence.ParameterData;
    import de.kumpelblase2.remoteentities.persistence.SerializeAs;
    import de.kumpelblase2.remoteentities.utilities.NMSClassMap;
    import de.kumpelblase2.remoteentities.utilities.ReflectionUtil;
     
    public class DesireFindEnemy extends DesireTargetBase
    {
    @SerializeAs(pos = 5)
    protected int m_targetChance;
    @SerializeAs(pos = 4)
    protected Class<? extends Entity> m_targetClass;
    protected DistanceComparator m_comparator;
    protected EntityLiving m_target;
    @SerializeAs(pos = 6)
    protected IEntitySelector m_selector; 
    protected boolean m_onlyAtNight;
    FactionsMain FM = new FactionsMain();
     
        public DesireFindEnemy(RemoteEntity inEntity, Class<?> inTargetClass, float inDistance, boolean inShouldCheckSight, int inChance)
        {
        this(inEntity, inTargetClass, inDistance, inShouldCheckSight, false, inChance);
        }   
     
        public DesireFindEnemy(RemoteEntity inEntity, Class<?> inTargetClass, float inDistance, boolean inShouldCheckSight, boolean inShouldMelee, int inChance)
        {
        this(inEntity, inTargetClass, inDistance, inShouldCheckSight, inShouldMelee, inChance, null);
        }
     
        @SuppressWarnings("unchecked")
        public DesireFindEnemy(RemoteEntity inEntity, Class<?> inTargetClass, float inDistance, boolean inShouldCheckSight, boolean inShouldMelee, int inChance, IEntitySelector inSelector)
        {
        super(inEntity, inDistance, inShouldCheckSight, inShouldMelee);
        this.m_comparator = new DistanceComparator(null, this.getEntityHandle());
        this.m_targetChance = inChance;
        if(Entity.class.isAssignableFrom(inTargetClass))
        this.m_targetClass = (Class<? extends Entity>)inTargetClass;
        else
        this.m_targetClass = (Class<? extends Entity>)NMSClassMap.getNMSClass(inTargetClass);
     
        this.m_onlyAtNight = false;
        this.m_type = DesireType.PRIMAL_INSTINCT;
        this.m_selector = inSelector;
        }
     
        public DesireFindEnemy(RemoteEntity inEntity, float inDistance, boolean inShouldCheckSight, boolean inMelee, Class<? extends EntityLiving> inTargetClass, int inChance){
        this(inEntity, inTargetClass, inDistance, inShouldCheckSight, inMelee, inChance);
        }
     
        public DesireFindEnemy(RemoteEntity inEntity, float inDistance, boolean inShouldCheckSight, boolean inMelee, Class<? extends EntityLiving> inTargetClass, int inChange, IEntitySelector inSelector)
        {
        this(inEntity, inTargetClass, inDistance, inShouldCheckSight, inMelee, inChange, inSelector);
        }
       
        @SuppressWarnings("unchecked")
        @Override
        public boolean shouldExecute()
        {
            if(this.getEntityHandle() == null)
                return false;
     
                if(this.m_onlyAtNight && this.getEntityHandle().world.v())
                    return false;
                else if(this.m_targetChance > 0 && this.getEntityHandle().aE().nextInt(this.m_targetChance) != 0)
                    return false;
                else
                {
                    if(this.m_targetClass == EntityHuman.class)
                    {
                        EntityHuman human = this.getEntityHandle().world.findNearbyVulnerablePlayer(this.getEntityHandle(), this.m_distance);
     
                        if(this.isSuitableTarget(human, false) && !FM.getFactionTag((Player) human).equals(this.getRemoteEntity().getBukkitEntity().getCustomName().split("[")[0]))
                        {
                            this.m_target = human;
                            return true;
                        }
                        else{
                            return false;
                        }
                    }
                    else
                    {
                        List<EntityLiving> entities = this.getEntityHandle().world.a(this.m_targetClass, this.getEntityHandle().boundingBox.grow(this.m_distance, 4, this.m_distance), this.m_selector);
                        Collections.sort(entities, this.m_comparator);
                        Iterator<EntityLiving> it = entities.iterator();
                            while(it.hasNext())
                            {
                                EntityLiving entity = it.next();
                                if(this.isSuitableTarget(entity, false))
                                {
                                    if(entity.getCustomName().contains("[")){
                                        if(entity.getCustomName().split("\\[")[0].equals(this.getRemoteEntity().getBukkitEntity().getCustomName().split("\\[")[0])){
                                            return false;
                                        }
                                    }
       
                                    if(entity instanceof Player && FM.getFactionTag((Player) entity).equals(this.getRemoteEntity().getBukkitEntity().getCustomName().split("\\[")[0])){
                                        return false;
                                    }
                                    this.m_target = entity;
                                    return true;
                                }
                            }
                    }
        return false;
            }
        }
     
        @Override
        public void startExecuting()
        {
            this.getEntityHandle().setGoalTarget(this.m_target);
            super.startExecuting();
        }
     
        @Override
        public ParameterData[] getSerializeableData()
        {
            return ReflectionUtil.getParameterDataForClass(this).toArray(new ParameterData[0]);
            }
    }
    Here's how the RemoteEntity was spawned:
    Code:
            ArrayList<RemoteEntity> reL = new ArrayList<RemoteEntity>();
            LivingEntity le = entity.getBukkitEntity();
            le.setCustomName(ChatColor.RED+""+faction+"["+ChatColor.GREEN+"||||||||||||||||||||"+ChatColor.RESET+"]");
            le.setCanPickupItems(true);
           
            if(army.get(e_loc) != null){
                reL.addAll(army.get(e_loc));
            }
           
            reL.add(entity);
            army.put(e_loc,reL);
           
            Mind mind = entity.getMind();
            mind.clearBehaviours();
            mind.clearMovementDesires();
            mind.clearTargetingDesires();
           
            mind.addTargetingDesire(new DesireFindEnemy(entity,LivingEntity.class,16, false, 100), 1); 
    I was wondering if you could PM me your skype username which would make it easier to talk.
     
  18. Offline

    Snipey

    If i increase the speed of an entity they start teleporting all over how can i fix this?


    Code:java
    1. @EventHandler
    2. public void onJoin(PlayerJoinEvent inEvent) throws Exception
    3. {
    4.  
    5. RemoteEntity entity = npcManager.createNamedEntity(RemoteEntityType.CaveSpider, inEvent.getPlayer().getLocation(), "test");
    6.  
    7. TamingFeature feature = new RemoteTamingFeature(entity);
    8. Mind mind = entity.getMind();
    9. mind.clearBehaviours();
    10. mind.clearMovementDesires();
    11. mind.clearTargetingDesires();
    12.  
    13. feature.tame(inEvent.getPlayer());
    14. entity.getFeatures().addFeature(feature);
    15. mind.addMovementDesire(new DesireFollowTamer(entity, 5, 15), entity.getMind().getHighestMovementPriority() + 1);
    16. entity.setSpeed(2.0F);
    17.  
    18. }
     
  19. JeroenV It does something: it gets the target. However, the entity doesn't know how to attack it, thus you need to add a movement desire which does that, like attackoncollide or rangedattack, depending on what you want.

    ICodeMaster Enderdragons are the worst to work with and I can still not really work with them properly as they work completely different than any other entity.

    Snipey Not setting the speed so high, nothing else you can do. If the next position for the entity is too far away minecraft natively just teleports them.

    mike0631 Listen on entity damage by entity event, check if the entity that is damaging is the remote entity and then just increase it.
     
  20. Offline

    JeroenV

    So I just want the zombie to move towards his target and try to kill it:
    Code:
    mind.addMovementDesire(new DesireKillTarget(entity,inTarget),2);
    However the problem for me is, how am I supposed to know what his inTarget is? Since the DesireFindEnemy would find his target:

    Code:
    mind.addTargetingDesire(new DesireFindEnemy(entity,LivingEntity.class,16, false, 100), 1);
    mind.addMovementDesire(new DesireKillTarget(entity,inTarget),2);
    Do I just fill in null as target?
     
  21. Offline

    ICodeMaster


    Thanks I may be able to find a way around it somehow. In a test i did a while ago teleporting an entity quickly makes it seem like fluent movement.
     
  22. So I'm currently in the process of updating it but I sadly have to realize that they completely fucked up the player entity to a point where you can't use it together with the other entities. I don't know if I will find a fix or a workaround for it so in the end I might need to disable some features for the player completely in order to keep it useable.


    JeroenV No, you just use a different desire. DesireKillTarget should be used when the entity should only try to kill that one exact target. You should take a look at AttackOnCollide (which will be renamed to MoveAndMeleeAttack to clarify its use in the next version) or RangedAttack which do what you want.
     
    shohouku likes this.
  23. First 1.6.1 snapshot is available via maven / jenkins if you want to try it out! I will do some testing and then we might have a realease version at some point.
     
    jb_aero likes this.
  24. Offline

    ICodeMaster

    I found the problem kind of, with the ender dragon pathing and tasks. Somehow with the current api you are creating an very large loop that is lagging/crashing a server. Just wanted to put that bug out there for you.

    ~ICode
     
  25. Offline

    shohouku

    Code:
    09:21:42 [SEVERE] Error occurred while enabling PlayRevolveNPC v1.0 (Is it up to
    date?)
    java.lang.NoClassDefFoundError: net/minecraft/server/v1_5_R3/Entity
            at de.kumpelblase2.remoteentities.EntityManager.<init>(EntityManager.jav
    a:35)
            at de.kumpelblase2.remoteentities.RemoteEntities.createManager(RemoteEnt
    ities.java:66)
            at de.kumpelblase2.remoteentities.RemoteEntities.createManager(RemoteEnt
    ities.java:50)
            at plugin.npc.onEnable(npc.java:31)
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader
    .java:457)
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManage
    r.java:381)
            at org.bukkit.craftbukkit.v1_6_R1.CraftServer.loadPlugin(CraftServer.jav
    a:282)
            at org.bukkit.craftbukkit.v1_6_R1.CraftServer.enablePlugins(CraftServer.
    java:264)
            at org.bukkit.craftbukkit.v1_6_R1.CraftServer.reload(CraftServer.java:60
    5)
            at org.bukkit.Bukkit.reload(Bukkit.java:275)
            at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:
    23)
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:18
    9)
            at org.bukkit.craftbukkit.v1_6_R1.CraftServer.dispatchCommand(CraftServe
    r.java:523)
            at org.bukkit.craftbukkit.v1_6_R1.CraftServer.dispatchServerCommand(Craf
    tServer.java:512)
            at net.minecraft.server.v1_6_R1.DedicatedServer.ar(DedicatedServer.java:
    262)
            at net.minecraft.server.v1_6_R1.DedicatedServer.t(DedicatedServer.java:2
    27)
            at net.minecraft.server.v1_6_R1.MinecraftServer.s(MinecraftServer.java:4
    87)
            at net.minecraft.server.v1_6_R1.MinecraftServer.run(MinecraftServer.java
    :420)
            at net.minecraft.server.v1_6_R1.ThreadServerApplication.run(SourceFile:5
    82)
    Caused by: java.lang.ClassNotFoundException: net.minecraft.server.v1_5_R3.Entity
     
            at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader
    .java:70)
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    java:53)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            ... 20 more
    Using 1.6.1 plugin, getting error :eek:

    @kumpelbase2

    Is there a certain class lib we are suppose to put into our plugin?

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

    Jumla

    Yes, add the remote entities jar as a dependency to your plugin (the same plugin as you download for the server)
    ----
    kumpelblase2,

    First off, amazing job with a prompt update. Works perfectly for me.
    Secondly, I have code which makes entities attack any type of living entity except players. It works perfectly for all mobs I've tried it on, but for pigmen, players become attacked. I clear the entire mind (targeting desires, movement desires, and behaviors) before giving desires. Any idea why pigmen do this and no other mobs?
     
  27. Offline

    shohouku

    For some reason I still get the error...
     
  28. Offline

    Jumla

    Oh right, your plugin is running 1.5.3 and I assume you've downloaded the newest version of remote entities, which runs on 1.6
     
  29. Offline

    shohouku


    My craftbukkit is 1.6.1

    I downloaded the new RemoteEntities 1.7 which is 1.6.1

    :confused:
     
  30. Offline

    soulofw0lf

    I've never had a problem importing your releases via maven but trying to switch to your snapshot it's saying that it doesn't exist. Do i have something set wrong for my maven?

    Code:java
    1. <repository>
    2. <id>remoteentities-repo</id>
    3. <url>[url]http://repo.infinityblade.de/remoteentities/snapshots</url>[/url]
    4. </repository>
    5. </repositories>
    6. <dependencies>
    7. <dependency>
    8. <groupId>de.kumpelblase2</groupId>
    9. <artifactId>remoteentities</artifactId>
    10. <version>1.7-SNAPSHOT</version>
    11. </dependency>


    any help is greatly appreciated!

    edit: and ignore the block url tags, the forums being dumb and not allowing me to remove them
     
Thread Status:
Not open for further replies.

Share This Page