Пример #1
0
 /**
  * Base chance for dropping seeds when the plant is picked. Default is 0.5*0.8^tier with a bigger
  * chance for sizes greater than 2 and absolutely no chance for size 0.
  *
  * @param crop reference to ICropTile
  * @return Chance to drop the seeds
  */
 public float dropSeedChance(ICropTile crop) {
   if (crop.getSize() == 1) return 0;
   float base = 0.5F;
   if (crop.getSize() == 2) base /= 2F;
   for (int i = 0; i < tier(); i++) {
     base *= 0.8;
   }
   return base;
 }
Пример #2
0
 /**
  * Check whether this plant spreads weed to surrounding tiles. Default is true if the plant has a
  * high growth stat (or is weeds) and size greater or equal than 2.
  *
  * @param crop reference to ICropTile
  * @return Whether the plant spreads weed
  */
 public boolean isWeed(ICropTile crop) {
   return crop.getSize() >= 2 && (crop.getID() == 0 || crop.getGrowth() >= 24);
 }
Пример #3
0
 /**
  * Obtain seeds dropped when the plant is picked. Multiple drops of the returned ItemStack can
  * occur. Default action is generating a seed from this crop.
  *
  * @param crop reference to ICropTile
  * @return Seeds
  */
 public ItemStack getSeeds(ICropTile crop) {
   return crop.generateSeeds(
       crop.getID(), crop.getGrowth(), crop.getGain(), crop.getResistance(), crop.getScanLevel());
 }
Пример #4
0
 /**
  * Called when the plant is leftclicked by a player. Default action is picking the plant.
  *
  * @param crop reference to ICropTile
  * @param player player leftclicked the crop
  * @return Whether the plant has changed
  */
 public boolean leftclick(ICropTile crop, EntityPlayer player) {
   return crop.pick(true);
 }
Пример #5
0
 /**
  * Called when the plant is rightclicked by a player. Default action is harvesting.
  *
  * @param crop reference to ICropTile
  * @param player player rightclicking the crop
  * @return Whether the plant has changed
  */
 public boolean rightclick(ICropTile crop, EntityPlayer player) {
   return crop.harvest(true);
 }
Пример #6
0
 /**
  * Used to determine whether the plant can crossbreed with another crop. Default is allow
  * crossbreeding if the size is greater or equal than 3.
  *
  * @param crop crop to crossbreed with
  */
 public boolean canCross(ICropTile crop) {
   return crop.getSize() >= 3;
 }
Пример #7
0
  /**
   * Sprite the crop is meant to be rendered with.
   *
   * @param crop reference to ICropTile
   * @return 0-255, representing the sprite index on the crop's spritesheet.
   */
  @SideOnly(Side.CLIENT)
  public IIcon getSprite(ICropTile crop) {
    if (crop.getSize() <= 0 || crop.getSize() > textures.length) return null;

    return textures[crop.getSize() - 1];
  }