Examples of IPollinatable


Examples of forestry.api.genetics.IPollinatable

  private boolean canPollinate() {
    if(entity.cooldownPollination > 0)
      return false;

    IPollinatable pollinatable = Utils.getOrCreatePollinatable(null, entity.worldObj, rest.posX, rest.posY, rest.posZ);
    if(pollinatable == null)
      return false;

    if(!entity.getButterfly().getGenome().getFlowerProvider().isAcceptedPollinatable(entity.worldObj, pollinatable))
      return false;

    if(entity.getPollen() != null && !pollinatable.canMateWith(entity.getPollen()))
      return false;

    return true;
  }
View Full Code Here

Examples of forestry.api.genetics.IPollinatable

      hasLayedEgg = true;
      entity.cooldownEgg = EntityButterfly.COOLDOWNS;
    }

    if(canPollinate && !hasPollinated) {
      IPollinatable pollinatable = (IPollinatable)entity.worldObj.getTileEntity(rest.posX, rest.posY, rest.posZ);
      if(entity.getPollen() == null) {
        entity.setPollen(pollinatable.getPollen());
        //Proxies.log.finest("A butterfly '%s' grabbed a pollen '%s' at %s/%s/%s.", entity.getButterfly().getIdent(), entity.getPollen().getIdent(), rest.posX, rest.posY, rest.posZ);
      } else if(pollinatable.canMateWith(entity.getPollen())) {
        pollinatable.mateWith(entity.getPollen());
        //Proxies.log.finest("A butterfly '%s' unloaded pollen '%s' at %s/%s/%s.", entity.getButterfly().getIdent(), entity.getPollen().getIdent(), rest.posX, rest.posY, rest.posZ);
        entity.setPollen(null);
      }
      hasPollinated = true;
      entity.cooldownPollination = EntityButterfly.COOLDOWNS;
View Full Code Here

Examples of forestry.api.genetics.IPollinatable

        }

        continue;
      }

      IPollinatable pitcher = (IPollinatable) tile;
      if (!genome.getFlowerProvider().isAcceptedPollinatable(housing.getWorld(), pitcher))
        continue;

      IIndividual pollen = pitcher.getPollen();

      if (pollen != null)
        return pollen;
    }
View Full Code Here

Examples of forestry.api.genetics.IPollinatable

      Vect randomPos = new Vect(housing.getWorld().rand.nextInt(area.x), housing.getWorld().rand.nextInt(area.y), housing.getWorld().rand.nextInt(area.z));

      Vect posBlock = randomPos.add(new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord()));
      posBlock = posBlock.add(offset);

      IPollinatable receiver = Utils.getOrCreatePollinatable(housing.getOwnerName(), housing.getWorld(), posBlock.x, posBlock.y, posBlock.z);
      if(receiver == null)
        continue;

      if (!genome.getFlowerProvider().isAcceptedPollinatable(housing.getWorld(), receiver))
        continue;
      if (!receiver.canMateWith(pollen))
        continue;

      receiver.mateWith(pollen);
      return true;
    }

    return false;
  }
View Full Code Here

Examples of forestry.api.genetics.IPollinatable

  }

  public static IPollinatable getOrCreatePollinatable(GameProfile owner, World world, int x, int y, int z) {
    TileEntity tile = world.getTileEntity(x, y, z);

    IPollinatable receiver = null;
    if (tile instanceof IPollinatable)
      receiver = (IPollinatable) tile;
    else if (!world.isAirBlock(x, y, z)) {

      // Test for ersatz genomes
View Full Code Here

Examples of forestry.api.genetics.IPollinatable

      TileEntity target = world.getTileEntity(x, y, z);
      if(!(target instanceof IPollinatable))
        return false;

      IPollinatable pollinatable = (IPollinatable)target;
      if(!pollinatable.canMateWith(tree))
        return false;

      pollinatable.mateWith(tree);
      Proxies.common.sendFXSignal(PacketFXSignal.VisualFXType.BLOCK_DESTROY, PacketFXSignal.SoundFXType.LEAF, world, x, y, z,
          world.getBlock(x, y, z), 0);
      if (!player.capabilities.isCreativeMode)
        itemstack.stackSize--;
      return true;
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.