Example #1
0
  public boolean a(ItemStack itemstack, EntityLiving entityliving) {
    if (entityliving instanceof EntitySheep) {
      EntitySheep entitysheep = (EntitySheep) entityliving;
      int i = BlockCloth.e_(itemstack.getData());

      if (!entitysheep.isSheared() && entitysheep.getColor() != i) {
        // CraftBukkit start
        byte bColor = (byte) i;
        SheepDyeWoolEvent event =
            new SheepDyeWoolEvent(
                (org.bukkit.entity.Sheep) entitysheep.getBukkitEntity(),
                org.bukkit.DyeColor.getByData(bColor));
        entitysheep.world.getServer().getPluginManager().callEvent(event);

        if (event.isCancelled()) {
          return false;
        }

        i = (byte) event.getColor().getData();
        // CraftBukkit end

        entitysheep.setColor(i);
        --itemstack.count;
      }

      return true;
    } else {
      return false;
    }
  }
Example #2
0
 public EntitySheep b(EntityAgeable entityageable) {
   EntitySheep entitysheep = (EntitySheep) entityageable;
   EntitySheep entitysheep1 = new EntitySheep(this.world);
   int i = this.a(this, entitysheep);
   entitysheep1.setColor(15 - i);
   return entitysheep1;
 }