Package org.bukkit.entity

Examples of org.bukkit.entity.Ageable


   
    if (type != null){
      if (type.equalsIgnoreCase("fire")){
        entity1.setFireTicks(40);
      } else if (type.equalsIgnoreCase("baby")){
        Ageable age = (Ageable) entity1;
        age.setBaby();
      } else if (type.equalsIgnoreCase("tamed")){
        Tameable tame = (Tameable) entity1;
        tame.setTamed(true);
      } else if (type.equalsIgnoreCase("angry")){
        if (toSpawn == EntityType.WOLF){
View Full Code Here


       
        if (type != null){
          if (type.equalsIgnoreCase("fire")){
            entity1.setFireTicks(40);
          } else if (type.equalsIgnoreCase("baby")){
            Ageable age = (Ageable) entity1;
            age.setBaby();
          } else if (type.equalsIgnoreCase("tamed")){
            Tameable tame = (Tameable) entity1;
            tame.setTamed(true);
          } else if (type.equalsIgnoreCase("angry")){
            if (toSpawn == EntityType.WOLF){
View Full Code Here

      location.setY(location.getY() + 1);
      Entity entity = player.getWorld().spawnEntity(location, toSpawn);
     
      if (type != null){
        if (type.equalsIgnoreCase("baby")){
          Ageable ageable = (Ageable) entity;
          ageable.setBaby();
        }
       
        if (type.equalsIgnoreCase("tamed")){
          Tameable tame = (Tameable) entity;
          tame.setTamed(true);
View Full Code Here

            if (entity instanceof Cow || entity instanceof Sheep) {

                if(InventoryUtil.doesInventoryContain(inv.getInventory(), false, new ItemStack(Material.WHEAT, 2))) {

                    if(InventoryUtil.removeItemsFromInventory(inv, new ItemStack(Material.WHEAT, 2))) {
                        Ageable animal = (Ageable) entity.getWorld().spawnEntity(entity.getLocation(), entity.getType());
                        animal.setBaby();
                        ((Ageable) entity).setBreed(false);
                        if(entity instanceof Sheep && animal instanceof Sheep)
                            ((Sheep) animal).setColor(((Sheep) entity).getColor());
                        return true;
                    }
                }
            } else if (entity instanceof Pig) {

                if(InventoryUtil.doesInventoryContain(inv.getInventory(), false, new ItemStack(Material.CARROT, 2))) {

                    if(InventoryUtil.removeItemsFromInventory(inv, new ItemStack(Material.CARROT, 2))) {
                        Ageable animal = (Ageable) entity.getWorld().spawnEntity(entity.getLocation(), entity.getType());
                        animal.setBaby();
                        ((Ageable) entity).setBreed(false);
                        return true;
                    }
                }
            } else if (entity instanceof Chicken) {
                if(InventoryUtil.doesInventoryContain(inv.getInventory(), false, new ItemStack(Material.SEEDS, 2))) {

                    if(InventoryUtil.removeItemsFromInventory(inv, new ItemStack(Material.SEEDS, 2))) {
                        Ageable animal = (Ageable) entity.getWorld().spawnEntity(entity.getLocation(), entity.getType());
                        animal.setBaby();
                        ((Ageable) entity).setBreed(false);
                        return true;
                    }
                }
            } else if (entity instanceof Wolf) {

                Material[] validItems = new Material[]{Material.RAW_CHICKEN, Material.COOKED_CHICKEN, Material.RAW_BEEF, Material.COOKED_BEEF, Material.PORK, Material.GRILLED_PORK, Material.ROTTEN_FLESH};

                for(Material item : validItems) {
                    if(InventoryUtil.doesInventoryContain(inv.getInventory(), false, new ItemStack(item, 2))) {
                        if(InventoryUtil.removeItemsFromInventory(inv, new ItemStack(item, 2))) {
                            Ageable animal = (Ageable) entity.getWorld().spawnEntity(entity.getLocation(), entity.getType());
                            animal.setBaby();
                            ((Ageable) entity).setBreed(false);
                            return true;
                        }
                    }
                }
View Full Code Here

TOP

Related Classes of org.bukkit.entity.Ageable

Copyright © 2018 www.massapicom. 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.