|| CreatureMovement API || Dev team in-the-making ||

Discussion in 'Plugin Development' started by -_Husky_-, May 1, 2012.

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

    -_Husky_-

    Hey Guy's, I'm Making a CreatureMovement API, And am in need of Some fellow Dev's With Knowledge with API's & Mob Movement

    What we would be doing:
    - Making a CreatureMovement API
    - Methods Like <mob>.moveLeft(), and others, etc.
    - Making a Easy way for dev's to hook into this to Move Mobs, the easy way.

    Looks like its just me...

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

    SirTyler

    I'll take a crack at helping, although I haven't don't much with overriding the notch code.
     
    -_Husky_- likes this.
  3. Offline

    dkabot

    I'd love to help out a bit, but I'd have to throw it together with the other stuff I'm working on.
    Granted, I have no experience modifying the code itself, so not sure if I would be of any help anyway.
     
  4. Offline

    Scyntrus

    Just to start you off, you'll probably have to create a subclass out of one of the existing entities, then in that subclass override one of the original class's methods and create your own. Then, you'll have to use the original (net.minecraft, not bukkit) minecraft world and make the entity spawn.
    Or something like that.
     
    Prgr likes this.
  5. Offline

    dkabot

    It must be something different... I can actually UNDERSTAND that explanation.
    If that is the case, it doesn't sound too horrible.
     
  6. Offline

    SirTyler

    Its not horrible, just simple reflection work. Only difficulty is making sure the entities work right and we are overriding the right methods.
     
  7. Offline

    codename_B

    Rather than .moveLeft() .moveRight() why not just have a .setTarget(Location location) and .setTarget(Entity entity) and let notch's pathfinding do the rest?
     
    jtjj222 and -_Husky_- like this.
  8. Offline

    SirTyler

    Greater control? I didn't understand the moveLeft and moveRight idea but I do know that setting the target will be set to null if the location is too far away, that is something I personally want to go about changing.
     
  9. Offline

    ItsHarry

    Indeed, moveLeft() wouldn't really make any sense.
     
  10. Offline

    dkabot

    I would imagine first a move(location) functions, then moveLeft(amount) etc. after that just call move(location) relative to the mob's directions.
     
  11. Offline

    Scyntrus

    True, the obfuscation is quite annoying. Good luck finding out what method to use. I also heard that the vanilla Minecraft method names change every so often, so keeping it update will be a pain. If you want a head start you could try reflecting some of the other mob controlling plugins, and see how they did it. I can only think of 2 of them right now.
     
  12. Offline

    SirTyler

    Well once we get the basics working updating wouldn't be too hard; we just have to find the methods and change our invoke to that, other then that its the same.
     
  13. Offline

    AmoebaMan

    If it would help, I can tell you how to set a LivingEntity's movement waypoint via CraftBukkit.

    The main problem with this process is that CraftBukkit's obfuscation changes every time the version updates - for this reason you'll have to update with every RB and find the right methods each time. However, there is a simple process you can follow to get the right methods. This works on Eclipse because of the auto-complete feature, but I don't know if it would work with any other IDE.
    1. First you need to get the handler. This method is unobfuscated and is always CraftLivingEntity.getHandle()
    2. Next find the method that returns the navigation object. This is obfuscated and will change with each RB. Use Eclipse's auto-complete to find the method: it will have no arguments and return a Navigation object.
    3. Find the method with 3 arguments of type double and one argument of type float. This is the movement method. The first three double args are the x, y, and z coordinates, and the float is the movement speed (0.25 is about average walking pace for zombies).
    Keep in mind that this only works for a few mobs though, namely any mob that uses the new MC path-finding engine (that'd be Creepers, Zombies, Skeletons, villagers, farm animals, and a few others).
     
  14. Hi!

    is this project still active?
     
  15. Offline

    -_Husky_-

    nope
     
  16. Offline

    Icyene

    Why not?
     
  17. Offline

    Jnorr44

    I've worked with this before, many of the tings you will be dealing with will require updates every bukkit/mc update. This means that all devs will also have to update your API every update for their plugin, and their plugin will break every mc/bukkit update aswell.
     
  18. Offline

    SirTyler

    Well its not a movement API, but I did create an Mob API that is included with ApiPlus and the Mob API Standalone version. I do plan to try and extend into allowing for custom definition of AI and maybe movement.
     
    -_Husky_- likes this.
  19. Offline

    -_Husky_-

    Got busy, abandoned it :/
     
  20. Offline

    Cybran

Thread Status:
Not open for further replies.

Share This Page