[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


    Alright, I'll try this out. Thanks for your reply :)
  2. Offline


    kumpelblase2 - that was just an example based on the posts in the 2nd page of the thread. I can see approaches to the code that you've taken from Citizens, such as this.W=1f (not in vanilla player code) this.motY = 0.6F instead of bZ() (again, not in vanilla player code), call to e, the pushing code overrides in every entity, the j_() logic. Not looking to degrade your work as I think this lib is great, just noticed this whilst reading the thread.
  3. Offline


    Getting this error every tick:
    1. at de.kumpelblase2.remoteentities.EntityManager$1.run(EntityManager.java:34)
    2. at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:53)
    3. at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftS
    4. cheduler.java:345)
    5. at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:529)
    6. at net.minecraft.server.DedicatedServer.r(DedicatedServer.java:222)
    7. at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:493)
    8. at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:426)
    9. at net.minecraft.server.ThreadServerApplication.run(SourceFile:856)

    My code: http://pastebin.com/dC2wjhhh
  4. Like I said, I can't deny the fact that I might've looked over it when I was just starting it, so the first two or three things you mentioned might've been things that sticked in my mind when I was trying to fix some stuff. The pushing stuff, however, was easily achieved by looking into the nms code and trying out some modifications, like I did in a lot of other cases.
    I don't really get what you mean with "the j_() logic", though.
    Furthermore, your license doesn't really define
    , at least as far as I understood it. Neither did you in your post, so clarifying that would be nice.
    I mean, the entityplayer was the first thing I worked on, so I stuff that I did there, I don't really remember now. Hence, I totally forgot the things that I might've gotten from you and thus not adding refers to your actual work. So I'm willing to do that now, but I don't know if that's what I'm thinking of is appropriate...

    Fixed. Also, EntityManager.removeEntity also despawns the entity. However, I changed it so it doesn't do that when you don't want to.

    bergerkiller : Found a theoretically working solution which I'm gonna test asap. When it works, there shouldn't be conflicts with other plugins, which alter the entity types enum, or the native code anymore.
  5. Offline


  6. Offline


    I have a slight issue.
    1) The NPCs despawn when the chunks unload (which makes sense) or
    2) The NPCs don't get sent to the player on logging in.
    I added a check, the NPC is actually spawned, just not visible to me. The location is also correct.

    EDIT: Also, it looks like RemoteEntityInteractEvent isn't firing.
    EDIT2: Looks like RemoteEntity.getBukkitEntity() returns null. Or it's getLocation(), but I think the first one.
    EDIT3: I want to be able of temporarily disabling NPCs. I thought calling despawn(CUSTOM), and calling spawn(loc) would do the job, but it seems it cannot find the RemoteEntity once I've done despawn. I tried using some nms methods, but the thread running in EntityManager sees the entity as a dead one, thus removing it. How would I go around temporarily disabling it?
  7. Everything noted down. But I'll take a bit more time for this one though, so that no similar issues pop up directly after I've done the changes...
  8. Offline


    kumpelblase2 - the code in j_() is similar to here. The license covers it under section 6. I don't want to upset anyone as you've put a lot of work into the lib, so any attribution can be at your discretion. Sorry if I've bothered you at all, just an observation when looking through the thread.
  9. I don't see a reason for you to be sorry, I mean I'm the one who should be sorry for totally forgetting to grant you the rights for that portion of code. I don't think anyone will be upset at all either, I mean it's not like that part is 20% of the lib or so.
  10. Offline


    Ah, I see the event gets fired now :) I will test it when I get back home, thanks you very much! You develop quickly, I like that very much :D
  11. haha, it's day-dependant, actually. I can do a lot from friday to tuesday, but won't be able to do much on wednesday and thursday :D
  12. Offline


    Oh, I see. Ah well :) If I ever see something I can help with, I'll send a pull request :) I'm getting pretty well into your code, actually.

    :confused: I just made an NPC rotate it's head 360 degrees :O
    stationary = true --> LookAtDesire. I LOL'd so hard :D

    EDIT: In other news, I can't seem to get the RemoteEntityInteractEvent.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 29, 2016
  13. Did you have an InteractBehavior on? If not, then it -was- supposed to not work, but I changed it so the event will get thrown regardless. I don't know why I made it to only get thrown when an interact behavior is present. Probably because I just made a quick fix without really thinking about it.
  14. Offline


    Oh, that's it, yeah :) Don't know how I missed that one while looking over the source...

    Also, I noticed setMaxHealth doesn't have the @Override annotation. I don't know how annotations work, and if it's needed, by my IDE told me to add one ^^
    EDIT: I should specify, RemotePlayerEntity

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


    Lolmewn - it's not needed, just a compiler hint. @Override annotations are not fully supported on Java 5, so it could be a compatibility thing.
  16. Offline


    Oh, right. Not that anyone is still using Java 5, but k :p
  17. Hint for changes in the latest snapshot:
    Show Spoiler

    You ever wanted to create a massive amount of stationary players with the same name? Now you can!
    CreateEntityContext context = entityManager.prepareEntity(RemoteEntityType.Human).withName("DERP").atLocation(player.getLocation()).asStationary(true).withID(10);
    for(int i = 0; i < 20; i++)
        RemoteEntity entity = context.create();
        //this entity should now have the id of 10+x
    I don't know know about you, but I always wanted to do that XD
  18. Offline


    I like that very much :)
    While looking through your code though, I noticed that .withID only changed it for the RemoteEntity, and not in the EntityManager. Not sure if that's needed, just noticed.
  19. see my reply on that line.
  20. Seeing as I'm more or less finished with the latest feature I'm aiming to push out the 1.2 release tomorrow. Still open for suggestions and feature requests, though.
  21. Offline


    What would be the best way to make a RemoteEntity move towards a coordinate target (lower priority) but attack certain entities on it's way (higher priority)? I saw the MoveToTarget desire, but that doesn't take coordinates as a parameter so I'm assuming it makes it move towards the entity it is targeting.
  22. You could create your own desire like MoveToLocation ;)

    Alright guys, pushed out 1.2! (I might've destroyed the maven repo though, sorry :( )
    - Updated with 1.4.5
    - Fixed melee
    - Fixed many NPEs
    - No longer interferes with other plugins using the entity type enum
    - Fixed standard goals for mushroom entity
    - Fixed entities not getting respawned on chunck reload
    - Fixed RemoteEntityInteractEvent not getting fired
    - Added new way for creating entities
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 29, 2016
  23. Offline


    Is there a way to set the swim speed of an entity?

    Just found a bug, with an agressive mob, if a player logs out whilst they are being targetted, the entity chasing them just stands still. Upon loging in, the entity just appears to stand there and does absolutely nothing. The target event is never ran. Never mind, updated the jar and it appears to work correctly.
  24. Sorry for that really late answer, but I don't know actually, I guess not but that might be wrong.

    However, I pushed out the 1.3 version. You can get it here or let maven do the magic for you.
    - Updated for Craftbukkit 1.4.5-R1.0.
    - Made it easier to add desires with CreateEntityContext.
    - Removed EntityEquipment feature.
    - Hopefully fixed concurrent exception.
    - Throwing some exceptions when using Remoteentities when it's not enabled.
    Just wrote down the changes I were interested in. If someone needs them, here you go:
    Show Spoiler

        bW() -> bV()
        bT() -> bS()
        bC -> bD
        bG -> bH
        bB -> bC
        bE -> bF
        bL -> bM
        bM -> bN
        bJ -> bL
        netServerHandler -> playerConnection
        bG -> bH
        bZ -> ca
        d_(itemstack) -> b_()
        bV -> bW
        bW -> bX
        bX -> bY
        aw -> ax
        f(boolean) -> g()
        ce() -> cd()
        bk -> bl
        ay -> az
        au -> av
        aB -> aC
        ax -> ay
        i -> j
        aM -> aN
    ItemInWorldManager -> PlayerInteractManager
    NetServerHandler -> PlayerConnection
    NetHandler -> Connection

    BTW: first 1.4-SNAPSHOT is out as well.

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


    He, atm I use TopCats Lib. Since the wolverness comitt i updated it, but I prefer to switch to your libary. Can you make the Lib as a plugin, like Vault or the Shield API? That would be very cool.
  26. It already is like that.
  27. Offline


    Thank you so much. You have just saved my MCRTS plugin. :3
  28. It is in the latest snapshot. It's not fully tested yet though.
  29. Offline


    Yes, my fault, I searched on bukkitdev not in the code or first post xd
    Can you publish it on bukkitdev? Or should I link it on my plugin page to your webpage?
Thread Status:
Not open for further replies.

Share This Page