How do you spawn a green villager?

Discussion in 'Plugin Development' started by bob9, Jul 19, 2012.

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


  2. You spawn a villager and then set the profesion ...
    Villager villager = (Villager)world.spawnCreature(location, EntityType.VILLAGER);
    So don't just copy paste the code and then complain it doesn't work.

    Read the wiki to find which profession has which robe color.
  3. Offline


    The profession with the green robe is just "Villager". There is no Profession.VILLAGER so you can't do it the way you said.
  4. Offline


    Well what happens if you dont set a profession?
  5. Offline


    it's brown, not green.
  6. bob9 likes this.
  7. Offline


    Would anyone mind doing this? I hope this is added to the next release.
  8. Offline


    Code forked and edited, pull request sent to the CraftBukkit project. :D
    V10lator likes this.
  9. Nice work. But please open a bug report at and link the request to the report and vice-versa. As far as I know the bukkit team doesn't accept pull requests if no report exists. ;)
  10. Offline


    Done :)

    Apparently the staff don't want this because Minecraft will be changing the code in the future.
    Looks like we'll have to wait for 1.3! ^_^

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 27, 2016
    V10lator and bob9 like this.
  11. :(
    Or use CB/Notch code in the meantime (untested):
    1. Villager villager = (Villager)world.spawnCEntity(location, EntityType.VILLAGER);
    2. ((CraftVillager)villager).getHandle().setProfession(5);
    bob9 and TheGreenGamerHD like this.
  12. Offline


    Good point. :D

    Btw --
    1. Location loc = p.getTargetBlock(null, 120).getLocation().add(0, 1, 0);
    2. Villager mob = (Villager)loc.getWorld().spawn(loc, Villager.class);
    3. ((CraftVillager)mob).getHandle().setProfession(5);

  13. Offline


    just saw this, thanks :)
  14. Offline

    Dr. Villager

    bob i know how to spawn a green villager easier all u need to do is /summon Villager ~0 ~0 ~0 {Profession:-1} and he should spawn.
Thread Status:
Not open for further replies.

Share This Page