Examples of IFruitBearer


Examples of forestry.api.genetics.IFruitBearer

  }
 
  @Override
  public boolean canBePicked(World world, int x, int y, int z)
  {
    IFruitBearer f = ForestryUtils.getFruitBearer(world.getBlockTileEntity(x, y, z));
    if(f.hasFruit() && f.getRipeness() >= 1.0f)
    {
      return true;
    }
    return false;
  }
View Full Code Here

Examples of forestry.api.genetics.IFruitBearer

 
  @SuppressWarnings({ "unchecked", "rawtypes" })
  @Override
  public List<ItemStack> getDrops(World world, Random rand, int x, int y, int z)
  {
    IFruitBearer f = ForestryUtils.getFruitBearer(world.getBlockTileEntity(x, y, z));
    return((List)f.pickFruit(ForestryUtils.getItem("grafter").copy()));
  }
View Full Code Here

Examples of forestry.api.genetics.IFruitBearer

  @Override
  public boolean fertilize(World world, Random rand, int x, int y, int z, FertilizerType fertilizerType)
  {
    if(world.getBlockId(x, y, z) == this.getFertilizableBlockId())
    {
      IFruitBearer f = ForestryUtils.getFruitBearer(world.getBlockTileEntity(x, y, z));
      if(f.hasFruit() && f.getRipeness() < 1.0f)
      {
        BonemealEvent event = new BonemealEvent(null, world, 1, x, y, z);
        MinecraftForge.EVENT_BUS.post(event);
        if(event.getResult().equals(BonemealEvent.Result.ALLOW))
        {
View Full Code Here

Examples of forestry.api.genetics.IFruitBearer

    if (tile instanceof TileSapling) {
      int result = ((TileSapling) tile).tryGrow(true);
      if (result == 1 || result == 2)
        event.setResult(Result.ALLOW);
    } else if (tile instanceof IFruitBearer) {
      IFruitBearer bearer = (IFruitBearer) tile;
      if (bearer.getRipeness() <= 1.0f) {
        bearer.addRipeness(1.0f);
        event.setResult(Result.ALLOW);
      }
    } else if(tile instanceof TileFruitPod) {
      if(((TileFruitPod)tile).canMature()) {
        ((TileFruitPod)tile).mature();
View Full Code Here

Examples of forestry.api.genetics.IFruitBearer

  @Override
  protected boolean isCrop(Vect pos) {
    TileEntity tile = world.getTileEntity(pos.x, pos.y, pos.z);
    if (!(tile instanceof IFruitBearer))
      return false;
    IFruitBearer bearer = (IFruitBearer) tile;
    if (!bearer.hasFruit())
      return false;
    if (bearer.getRipeness() < 0.9f)
      return false;

    return true;
  }
View Full Code Here

Examples of forestry.api.genetics.IFruitBearer

    Set<Vect> seen = new HashSet<Vect>();
    Stack<ICrop> crops = new Stack<ICrop>();

    // Determine what type we want to harvest.
    IFruitBearer bearer = getFruitBlock(position);
    Block block = getBlock(position);
    if ((!block.isWood(getWorld(), position.x, position.y, position.z)) && bearer == null)
      return crops;

    ArrayList<Vect> candidates = processHarvestBlock(crops, seen, position, position);
View Full Code Here

Examples of forestry.api.genetics.IFruitBearer

          // See whether the given position has already been processed
          if (seen.contains(candidate))
            continue;

          IFruitBearer bearer = getFruitBlock(candidate);
          if (bearer != null && bearer.hasFruit()) {
            if (bearer.getRipeness() >= 0.9f)
              crops.push(new CropFruit(world, candidate, bearer.getFruitFamily()));
            candidates.add(candidate);
            seen.add(candidate);
          } else if (this.isWoodBlock(candidate)) {
            candidates.add(candidate);
            seen.add(candidate);
View Full Code Here
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.