Package forestry.api.arboriculture

Examples of forestry.api.arboriculture.ITree


    if(world.getBlockId(x, y, z) == this.getFertilizableBlockId())
    {
      TileEntity t = world.getBlockTileEntity(x, y, z);
      if(PlantableForestryTree.TileTreeContainer.isInstance(t))
      {
        ITree tree = PlantableForestryTree.getTree(t);
        return tree.getTreeGenerator(world, x, y, z, true).generate(world, rand, x, y, z);
      }
    }
    return false;
  }
View Full Code Here


    if(stack.isItemEqual(_sapling))
    {
      TileEntity t = world.getBlockTileEntity(x, y, z);
      if(TileTreeContainer.isInstance(t))
      {
        ITree tree = ForestryUtils.root.getMember(stack);
        try
        {
          _setTree.invoke(t, new Object[] { tree });
        }
        catch(Throwable TREE)
View Full Code Here

      ChestGenHooks.addItem(Defaults.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(this.getTreeItemFromTemplate(TreeTemplates.getLimeTemplate(), EnumGermlingType.POLLEN), 1, 2, 3));
    }
  }

  private ItemStack getTreeItemFromTemplate(IAllele[] template, EnumGermlingType type) {
    ITree tree = new Tree(PluginArboriculture.treeInterface.templateAsGenome(template));
    ItemStack treeItem;
    switch (type) {
    default:
    case POLLEN:
      treeItem = ForestryItem.pollenFertile.getItemStack();
      break;
    case SAPLING:
      treeItem = ForestryItem.sapling.getItemStack();
    }
    NBTTagCompound nbtTagCompound = new NBTTagCompound();
    tree.writeToNBT(nbtTagCompound);
    treeItem.setTagCompound(nbtTagCompound);
    return treeItem;
  }
View Full Code Here

    Block block = StackUtils.getBlock(itemStack);

    if (!(itemStack.getItem() instanceof ItemLeavesBlock) || !itemStack.hasTagCompound())
      return;

    ITree tree = getTree(itemStack);
    if (tree == null)
      return;

    GL11.glEnable(GL11.GL_BLEND);
View Full Code Here

  @Override
  protected void drawGuiContainerBackgroundLayer(float var1, int mouseX, int mouseY) {
    super.drawGuiContainerBackgroundLayer(var1, mouseX, mouseY);

    int page = 0;
    ITree tree = null;
    EnumGermlingType treeType = EnumGermlingType.SAPLING;
    for (int k = 1; k < TreealyzerInventory.SLOT_ANALYZE_5 + 1; k++) {
      if (k == TreealyzerInventory.SLOT_ENERGY)
        continue;

      if (inventory.getStackInSlot(k) == null)
        continue;
      tree = PluginArboriculture.treeInterface.getMember(inventory.getStackInSlot(k));
      treeType = PluginArboriculture.treeInterface.getType(inventory.getStackInSlot(k));
      if (tree == null || !tree.isAnalyzed())
        continue;

      page = k;
      break;
    }
View Full Code Here

    super(Blocks.sapling, -1, new ItemStack(Items.apple), new ItemStack(FarmableCocoa.COCOA_SEED, 1, FarmableCocoa.COCOA_META));
  }

  @Override
  public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, int x, int y, int z) {
    ITree tree = null;
    for (Map.Entry<ItemStack, IIndividual> entry : AlleleManager.ersatzSaplings.entrySet())
      if (entry.getKey().isItemEqual(germling) && entry.getValue() instanceof ITree) {
        tree = (ITree) entry.getValue();
        break;
      }
View Full Code Here

        TileEntity tile = world.getTileEntity(x, yPos, z);
        if (!(tile instanceof TileSapling))
          return false;

        ITree tree = ((TileSapling) tile).getTree();
        if (tree == null || !tree.getGenome().getPrimary().getUID().equals(genome.getPrimary().getUID()))
          return false;
      }

    return true;
  }
View Full Code Here

  }

  public static ItemStack convertSaplingToGeneticEquivalent(ItemStack foreign) {

    ItemStack ersatz = null;
    ITree tree = null;

    for (Map.Entry<ItemStack, IIndividual> entry : AlleleManager.ersatzSaplings.entrySet()) {
      if (entry.getKey().getItem() != foreign.getItem())
        continue;
      if (entry.getKey().getItemDamage() != foreign.getItemDamage())
View Full Code Here

  @Override
  public String getItemStackDisplayName(ItemStack itemstack) {
    String type = StringUtil.localize("trees.grammar.leaves.type");
    if (!itemstack.hasTagCompound())
      return type;
    ITree tree = getTree(itemstack);
    String customTreeKey = "trees.custom.leaves." + tree.getGenome().getPrimary().getUnlocalizedName().replace("trees.species.","");
    if(StringUtil.canTranslate(customTreeKey)){
      return StringUtil.localize(customTreeKey);
    }
    String grammar = StringUtil.localize("trees.grammar.leaves");

    return grammar.replaceAll("%SPECIES", tree.getDisplayName()).replaceAll("%TYPE", type);
  }
View Full Code Here

  @Override
  public int getColorFromItemStack(ItemStack itemstack, int renderPass) {
    if (!itemstack.hasTagCompound())
      return PluginArboriculture.proxy.getFoliageColorBasic();
    ITree tree = getTree(itemstack);
    if (tree == null)
      return PluginArboriculture.proxy.getFoliageColorBasic();
    return tree.getGenome().getPrimary().getLeafColour(tree);
  }
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.