[Tutorial][Api+] Customize Mobs

Discussion in 'Resources' started by SirTyler, Aug 19, 2012.

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

    SirTyler

    So with the new update to my Api+ plugin, which adds a Mob API, I decided to create a tutorial on how to use it to customize mobs. So to start off with, you obviously need the Api+ plugin which can be downloaded here. So to create a new mob we need to create an instance of an APIMob, we will make a new zombie:
    Code:java
    1. ItemStack[] drops = {new ItemStack(Material.APPLE)};
    2. ItemStack[] rare = {new ItemStack(Material.BUCKET)};
    3. APIMob zombie = new APIMob(EntityType.ZOMBIE, 2, 0, 1, drops, rare, 10000, 150.0, 2);
    4. MobManager.getInstance().setNewAPIMob(zombie);


    So the first two ItemStack Arrays we create are for the Items the zombie will drop. The first array called 'drops' being the normal drops and the second array called 'rare' being the rare drops. Now for the constructor of the APIMob we have the EntityType that defines this Mob (in this case the Zombie), we have the Health of the mob (1 = 1/2 heart, so 2 being 1 heart), we have the Armor of the mob, the Damage they do (Same as with health, 1 = 1/2 heart), we have the drops and rare drops array, we have the experience the mob drops when it dies, the range the mob can see us at, and last is the speed modifier (How much faster the mob can move at). The last line we get the MobManager of Api+ using the getInstance() method, and then we call the setNewAPIMob(APIMob) method for our new zombie. After that our new mob has been loaded onto the server and all new spawned Zombies will be of this new type.

    Currently the only supported mobs are Zombies, Skeletons, Spiders, and Creepers; but more will be added as time goes on.
     
  2. Offline

    Milkywayz

    You should probably put somewhere that it requires spout and spoutcraft, like you did on the bukkitdev page. :p
     
  3. Offline

    SirTyler

    Well the MobAPI itself doesn't, That is for other parts of Api+. I will be making a 'light' version of Api+ that will be the MobAPI only for people that do not want the rest of Api+ (and vice-versa).
     
  4. Offline

    Milkywayz

    Good idea, forcing spout isn't a good idea imo. Also you should release the licensed source so people can drag the package into their project and work with it seamlessly / dependency free. Just an idea however ;)
     
  5. Offline

    SirTyler

    Never really looked much into licenses but the source IS up, just follow the source link on the BukkitDev project and you will be at the github.
     
  6. Offline

    Milkywayz

    Well it needs to be licensed for anyone to use it technically, that is if they include it in their plugin. Most developers won't touch unlicensed code since technically you can't use it without express consent of the author.
     
  7. Offline

    SirTyler

    Recommendation for the license?
     
  8. Offline

    Milkywayz

Thread Status:
Not open for further replies.

Share This Page