Package org.bukkit

Examples of org.bukkit.TreeSpecies


        if (mcMMO.getModManager().isCustomLog(blockState)) {
            return mcMMO.getModManager().getBlock(blockState).getXpGain();
        }

        //TODO Remove this workaround when casting to Tree works again
        TreeSpecies species = TreeSpecies.GENERIC;
        if (blockState.getData() instanceof Tree) {
            species = ((Tree) blockState.getData()).getSpecies();
        }

        int xp = ExperienceConfig.getInstance().getWoodcuttingTreeXP(species);
View Full Code Here


        if (mcMMO.getModManager().isCustomLog(blockState) && mcMMO.getModManager().getBlock(blockState).isDoubleDropEnabled()) {
            Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops());
        }
        else {
            //TODO Remove this workaround when casting to Tree works again
            TreeSpecies species = TreeSpecies.GENERIC;
            if (blockState.getData() instanceof Tree) {
                species = ((Tree) blockState.getData()).getSpecies();
            }

            if (Config.getInstance().getWoodcuttingDoubleDropsEnabled(species)) {
View Full Code Here

        } else if (mat == Material.CACTUS) {
            setData((byte) 9);
        } else if (mat == Material.DEAD_BUSH) {
            setData((byte) 10);
        } else if (mat == Material.SAPLING) {
            TreeSpecies species = ((Tree) materialData).getSpecies();

            if (species == TreeSpecies.GENERIC) {
                setData((byte) 3);
            } else if (species == TreeSpecies.REDWOOD) {
                setData((byte) 4);
View Full Code Here

        boolean hasPlanted = false;

        if(!player.hasPermission("craftbook.mech.treelopper.sapling"))
            hasPlanted = true;

        TreeSpecies species = null;
        if(placeSaplings && usedBlock.getState().getData() instanceof Tree && (usedBlock.getRelative(0, -1, 0).getType() == Material.DIRT || usedBlock.getRelative(0, -1, 0).getType() == Material.GRASS || usedBlock.getRelative(0, -1, 0).getType() == Material.MYCEL) && !hasPlanted)
            species = ((Tree) usedBlock.getState().getData()).getSpecies();
        usedBlock.breakNaturally(event.getPlayer().getItemInHand());
        if(species != null) {
            final TreeSpecies fspecies = species;
            Bukkit.getScheduler().runTaskLater(CraftBookPlugin.inst(), new Runnable() {

                @Override
                public void run () {
                    usedBlock.setType(Material.SAPLING);
View Full Code Here

            return false;
        if(broken > maxSearchSize)
            return false;
        if(!enabledItems.contains(player.getHeldItemInfo()))
            return false;
        TreeSpecies species = null;
        if(placeSaplings && (block.getRelative(0, -1, 0).getType() == Material.DIRT || block.getRelative(0, -1, 0).getType() == Material.GRASS || block.getRelative(0, -1, 0).getType() == Material.MYCEL) && !hasPlanted)
            species = ((Tree) block.getState().getData()).getSpecies();
        block.breakNaturally(event.getPlayer().getItemInHand());
        if(species != null) {
            block.setType(Material.SAPLING);
View Full Code Here

  public static int parseMaterialData(String text, Material material, int def) {
    try {
      return Integer.parseInt(text);
    } catch (NumberFormatException ex) {
      if (material == Material.WOOD) {
        TreeSpecies ts = parseTreeSpecies(text, null);
        if (ts != null) {
          return MaterialUtil.getRawData(ts);
        }
        return def;
      } else {
        MaterialData dat = MaterialUtil.getData(material, 0);
        if (dat instanceof TexturedMaterial) {
          TexturedMaterial tdat = (TexturedMaterial) dat;
          Material mat = parseMaterial(text, null);
          if (mat == null)
            return def;
          tdat.setMaterial(mat);
        } else if (dat instanceof Wool) {
          Wool wdat = (Wool) dat;
          DyeColor color = parseEnum(DyeColor.class, text, null);
          if (color == null)
            return def;
          wdat.setColor(color);
        } else if (dat instanceof Tree) {
          Tree tdat = (Tree) dat;
          TreeSpecies species = parseTreeSpecies(text, null);
          if (species == null)
            return def;
          tdat.setSpecies(species);
        } else if (dat instanceof Leaves) {
          Leaves tdat = (Leaves) dat;
          TreeSpecies species = parseTreeSpecies(text, null);
          if (species == null)
            return def;
          tdat.setSpecies(species);
        } else if (dat instanceof LongGrass) {
          LongGrass ldat = (LongGrass) dat;
View Full Code Here

                DyeColor color = ((Colorable) data).getColor();

                return (color != null ? color.name() : null);
            } else if (data instanceof Tree) {
                //TreeSpecies specie = TreeSpecies.getByData((byte) (data.getData() & 3)); //This works, but not as intended
                TreeSpecies specie = ((Tree) data).getSpecies();
                return (specie != null && specie != TreeSpecies.GENERIC ? specie.name() : null);
            } else if (data instanceof SpawnEgg) {
                EntityType type = ((SpawnEgg) data).getSpawnedType();
                return (type != null ? type.name() : null);
            } else if (data instanceof Coal) {
                CoalType coal = ((Coal) data).getType();
View Full Code Here

TOP

Related Classes of org.bukkit.TreeSpecies

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.