Package powercrystals.minefactoryreloaded.modhelpers.forestry.trees

Source Code of powercrystals.minefactoryreloaded.modhelpers.forestry.trees.FertilizableForestryTree

package powercrystals.minefactoryreloaded.modhelpers.forestry.trees;

import forestry.api.arboriculture.ITree;
import java.util.Random;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import powercrystals.minefactoryreloaded.api.FertilizerType;
import powercrystals.minefactoryreloaded.api.IFactoryFertilizable;

public class FertilizableForestryTree implements IFactoryFertilizable
{
  @Override
  public int getFertilizableBlockId()
  {
    return PlantableForestryTree.sapling.blockID;
  }
 
  @Override
  public boolean canFertilizeBlock(World world, int x, int y, int z, FertilizerType fertilizerType)
  {
    return world.getBlockId(x, y, z) == this.getFertilizableBlockId();
  }
 
  @Override
  public boolean fertilize(World world, Random rand, int x, int y, int z, FertilizerType fertilizerType)
  {
    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;
  }
}
TOP

Related Classes of powercrystals.minefactoryreloaded.modhelpers.forestry.trees.FertilizableForestryTree

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.