Examples of ICropTile


Examples of ic2.api.crops.ICropTile

    TileEntity te = world.getBlockTileEntity(x, y, z);
    if(te == null || !(te instanceof ICropTile))
    {
      return false;
    }
    ICropTile tec = (ICropTile)te;
    CropCard crop;
    try
    {
      crop = (CropCard)_getCropMethod.invoke(tec);
      if(tec.getID() < 0 || !crop.canBeHarvested(tec) || crop.canGrow(tec))
      {
        return false;
      }
    }
    catch(Exception e)
View Full Code Here

Examples of ic2.api.crops.ICropTile

  @Override
  public List<ItemStack> getDrops(World world, Random rand, Map<String, Boolean> harvesterSettings, int x, int y, int z)
  {
    List<ItemStack> drops = new ArrayList<ItemStack>();
   
    ICropTile tec = (ICropTile)world.getBlockTileEntity(x, y, z);
    CropCard crop;
    try
    {
      crop = (CropCard)_getCropMethod.invoke(tec);
     
      float chance = crop.dropGainChance();
      for (int i = 0; i < tec.getGain(); i++)
      {
        chance *= 1.03F;
      }
     
      chance -= rand.nextFloat();
      int numDrops = 0;
      while (chance > 0.0F)
      {
        numDrops++;
        chance -= rand.nextFloat();
      }
      ItemStack[] cropDrops = new ItemStack[numDrops];
      for (int i = 0; i < numDrops; i++)
      {
        cropDrops[i] = crop.getGain(tec);
        if((cropDrops[i] != null) && (rand.nextInt(100) <= tec.getGain()))
        {
          cropDrops[i].stackSize += 1;
        }
      }
     
      tec.setSize(crop.getSizeAfterHarvest(tec));
      _dirtyField.setBoolean(tec, true);
      for(ItemStack s : cropDrops)
      {
        drops.add(s);
      }
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.