/** * 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; }
/** * 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); }
/** * 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()); }
/** * 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); }
/** * 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); }
/** * 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; }
/** * 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]; }