Spawning "GREEN" Villager, new profession and event

Discussion in 'Plugin Development' started by shadyre, Jul 4, 2012.

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

    shadyre

    Hi all, for my plugin i need to make a new profession for villager same as a NPC guard with event for fight and protect area.

    First i don't know how to spawn a simple Villager without profession ("grren" villager) i used :
    Code:
    Entity e = w.spawnCreature(player.getLocation(), EntityType.VILLAGER);
     
    Villager v = (Villager)e;
    v.setProfession(Profession.getProfession(5));
    or
    v.setProfession(Profession.FARMER);
    But when i used the first method, with "getProfession(id)" i got an error, can i make my own profession or not ?
    If yes how ... i have test to implements Villager with a personnal class but nothing i don't know how to proceed.

    Sorry for my english i'm french ..

    EDIT :
    I used : "
    Entity e = w.spawnCreature(player.getLocation(), EntityType.VILLAGER);" because i modify some option like "Creature c = (Creature)e;" and "c.setTarget(player);"
     
  2. Offline

    ZeusAllMighty11

    In my plugin TransformCreature on BukkitDev, I set the profession by like:
    v.setProfession(librarian) as opposed to an int
     
Thread Status:
Not open for further replies.

Share This Page