Package forestry.api.arboriculture

Examples of forestry.api.arboriculture.ITree


  @Override
  public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
    if (!stack.hasTagCompound())
      return false;
    ITree tree = getTree(stack);
    if (tree == null)
      return false;
    GameProfile owner = player.getGameProfile();
    return PluginArboriculture.treeInterface.setLeaves(world, tree, owner, x, y, z, true);
  }
View Full Code Here


    return (TileLeaves) tile;
  }

  private static NBTTagCompound getTagCompoundForTree(IBlockAccess world, int x, int y, int z) {
    TileLeaves leaves = getLeafTile(world, x, y, z);
    ITree tree = leaves.getTree();

    NBTTagCompound nbttagcompound = new NBTTagCompound();
    if (tree == null)
      return nbttagcompound;

    tree.writeToNBT(nbttagcompound);
    return nbttagcompound;
  }
View Full Code Here

      if (!PluginArboriculture.treeInterface.isMember(getStackInSlot(SLOT_SPECIMEN))) {
        ItemStack ersatz = Utils.convertSaplingToGeneticEquivalent(getStackInSlot(SLOT_SPECIMEN));
        if (ersatz != null)
          setInventorySlotContents(SLOT_SPECIMEN, ersatz);
      }
      ITree tree = PluginArboriculture.treeInterface.getMember(getStackInSlot(SLOT_SPECIMEN));
      // No tree, abort
      if (tree == null)
        return;

      // Analyze if necessary
      if (!tree.isAnalyzed()) {

        // Requires energy
        if (!isEnergy(getStackInSlot(SLOT_ENERGY)))
          return;

        tree.analyze();
        if (player != null) {
          PluginArboriculture.treeInterface.getBreedingTracker(player.worldObj, player.getGameProfile()).registerSpecies(tree.getGenome().getPrimary());
          PluginArboriculture.treeInterface.getBreedingTracker(player.worldObj, player.getGameProfile()).registerSpecies(tree.getGenome().getSecondary());
        }
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        tree.writeToNBT(nbttagcompound);
        getStackInSlot(SLOT_SPECIMEN).setTagCompound(nbttagcompound);

        // Decrease energy
        decrStackSize(SLOT_ENERGY, 1);
      }
View Full Code Here

  public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int par7, float facingX, float facingY, float facingZ) {

    if (!Proxies.common.isSimulating(world))
      return false;

    ITree tree = PluginArboriculture.treeInterface.getMember(itemstack);
    if(tree == null)
      return false;

    if(type == EnumGermlingType.SAPLING) {
      // x, y, z are the coordinates of the block "hit", can thus either be the soil or tall grass, etc.
      int yShift;
      if (!Utils.isReplaceableBlock(world, x, y, z)) {
        if (!world.isAirBlock(x, y + 1, z))
          return false;
        yShift = 1;
      } else
        yShift = 0;

      if (!tree.canStay(world, x, y + yShift, z))
        return false;

      if (PluginArboriculture.treeInterface.plantSapling(world, tree, player.getGameProfile(), x, y + yShift, z)) {
        Proxies.common.addBlockPlaceEffects(world, x, y, z, world.getBlock(x, y + yShift, z), 0);
        if (!player.capabilities.isCreativeMode)
View Full Code Here

      return false;
  }

  @Override
  public float getFermentationModifier(ItemStack itemstack) {
    ITree tree = PluginArboriculture.treeInterface.getMember(itemstack);
    if (tree == null)
      return 1.0f;

    return tree.getGenome().getSappiness() * 10;
  }
 
View Full Code Here

TOP

Related Classes of forestry.api.arboriculture.ITree

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.