Modify Mob Behaviour

Discussion in 'Plugin Development' started by weaversam8, Jul 15, 2013.

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

    Jacek

    xigsag This isn't something I've done before, maybe look at the way other NPC systems do it.
     
  2. Offline

    Comphenix

    For future reference, if you get a "end of stream, I recommend recompiling CraftBukkit at this location with the following line:
    Code:
    eofexception.printStackTrace();
    Then you'll at least get the cause of the error, and know where to look.

    Unfortunately the wiki is wrong - the coordinates are not just the absolute integer position, they are "fixed decimal points" with 5 decimal bits. In other words, multiply each coordinate by 32 (you may have to cast to int):
    Code:
    this.c=l.getX() * 32;
    this.d=l.getY() * 32;
    this.e=l.getZ() * 32;
    You can determine this yourself by examining the source code of Packet18SpawnMob (and EnumEntitySize). Or perhaps with PacketWrapper (if you ever decide to use ProtocolLib).

    There's also a library for creating these kinds of entities, though you probably won't need it unless you also want the entity to do a little more than stand still.
     
    Jacek likes this.
  3. Offline

    xigsag

    Comphenix
    Thanks, I'll take a read at those things.

    On another hand, I've actually gotten it to work by leeching open source code from NPCLib, updating the imports (nms) to the current bukkit lib build that I'm using, and tried spawning in the Human given in the library.

    Good thing is, I went ahead and studied the code, and to my surprise, i understood it.

    This library allows me to set the player's armor contents, item in hand, and whether it's crouching or not.
    This is the library's git.
     
Thread Status:
Not open for further replies.

Share This Page