Colored Sheep

Discussion in 'Plugin Development' started by JPG2000, Jun 13, 2013.

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

    JPG2000

    Hey! How would I make it so a sheep would spawn in colored?

    Heres my code:
    player.getWorld().spawnCreature(location, EntityType.SHEEP).setCustomName(ChatColor.AQUA + "Troll");;
     
  2. Offline

    xize

    I thought there whas a setDyeColor when you use Sheep as object type;)
     
  3. Offline

    Shzylo

    can you show more code?
     
  4. Cast it to a Sheep.
    Code:java
    1. Sheep sheep = (Sheep) player.getWorld().spawnEntity(location, EntityType.SHEEP);
    2.  
    3. sheep.setCustomName("HerpDerp");
    4. sheep.setColor(DyeColor.PINK);
     
  5. Offline

    xize

    yes I thought it whas something like:

    Code:java
    1.  
    2. Entity entity = player.getWorld().spawnEntity(player.getLocation, EntityType.SHEEP);
    3. if(entity instanceof Sheep) {
    4. Sheep sheep = (Sheep) entity;
    5. sheep.setDyeColor(Color.BLUE);
    6. }
    7.  


    I thought it whas something like this but I can be mistaken, however I'm not sure how it behaves on a command or spawn eggs.
     
  6. Offline

    Shzylo

    are you using the @EventHandler and are you registering the Listener?
     
  7. Offline

    xize

    yes, but I guess it works I just said that because I never really used this
     
Thread Status:
Not open for further replies.

Share This Page