Examples of Sheep


Examples of org.bukkit.entity.Sheep

          oce.setCatType(ClosestMatches.catType(type).get(0));
        }
       
        if (type.startsWith("sheepcolor:")){
          type = type.split(":")[1];
          Sheep sheep = (Sheep) entity;
          sheep.setColor(ClosestMatches.dyeColor(type).get(0));
        }
      }
    }
   
    LogHelper.showInfo("mobsSuccess#####[" + amount + " " + Utils.userFriendlyNames((type != null ? type + " " : "") + toSpawn.name()), sender, ChatColor.AQUA);
View Full Code Here

Examples of org.bukkit.entity.Sheep

            }

            // Extra processing depending on the mob and drop type
            switch (target.getType()) {
                case SHEEP:
                    Sheep sheep = (Sheep) target;

                    if (drop.getType() == Material.WOOL) {
                        if (sheep.isSheared()) {
                            return;
                        }

                        drop = new Wool(sheep.getColor()).toItemStack(drop.getAmount());
                        sheep.setSheared(true);
                    }
                    break;

                case SKELETON:
                    if (((Skeleton) target).getSkeletonType() == SkeletonType.WITHER) {
View Full Code Here

Examples of org.bukkit.entity.Sheep

        if (entity instanceof Sheep) {

            if(doesChestContain(Material.SHEARS)) {

                Sheep sh = (Sheep) entity;
                return !sh.isSheared();

            }
        }

        return false;
View Full Code Here

Examples of org.bukkit.entity.Sheep

        if (entity instanceof Sheep) {

            if(doesChestContain(Material.SHEARS)) {

                Sheep sh = (Sheep) entity;
                if(sh.isSheared())
                    return false;
                sh.setSheared(true);
                return addToChest(new ItemStack(Material.WOOL, 3, sh.getColor().getWoolData()));
            }
        }

        return false;
    }
View Full Code Here

Examples of org.bukkit.entity.Sheep

    if (canShear) {
      List<Entity> entities = entity.getNearbyEntities(radius, 2, radius);
      for (Entity i : entities) {
        if (EntityType.SHEEP.equals(i.getType())) {
          Sheep sheep = (Sheep) i;
          if ((shears > 0) && (!sheep.isSheared())) {
            DyeColor color = sheep.getColor();
            byte data = color.getData();
            wool[data] += 1 + ((int) (Math.random() * 2.0));
            sheep.setSheared(true);
            --shears;
          }
        }
      }
      lastShear = now;
View Full Code Here

Examples of org.spout.vanilla.component.entity.living.passive.Sheep

  }

  @Override
  public void onInteract(Entity entity, Entity other, Action action) {
    if (action == Action.RIGHT_CLICK) {
      Sheep sheep = other.get(Sheep.class);
      if (sheep == null) {
        return;
      }

      Slot inv = PlayerUtil.getHeldSlot(entity);
      if (inv != null && inv.get() != null) {
        // get color from holding item
        sheep.setColor(Wool.WoolColor.getById((short) (0xF - inv.get().getData())));
        if (!PlayerUtil.isCostSuppressed(entity)) {
          inv.addAmount(-1);
        }
      }
    }
View Full Code Here

Examples of org.spout.vanilla.component.entity.living.passive.Sheep

  }

  @Override
  public void onInteract(Entity entity, Entity other, Action action) {
    if (action == Action.RIGHT_CLICK) {
      Sheep sheep = other.get(Sheep.class);

      if (sheep == null) {
        return;
      }

      if (sheep.isSheared()) {
        //TODO: Also return if this is a baby sheep
        return;
      }
      short col = sheep.getColor().getData();
      ItemStack itemStack = new ItemStack(VanillaMaterials.WOOL, col, GenericMath.getRandom().nextInt(3) + 1);

      SheepShearedEvent event = VanillaPlugin.getInstance().getEngine().getEventManager().callEvent(new SheepShearedEvent(other, entity, itemStack));

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

      sheep.setSheared(true);

      Item.dropNaturally(other.getPhysics().getPosition(), event.getItemStack());
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.