Search in sources :

Example 1 with IAgriStatsMap

use of com.infinityraider.agricraft.api.v1.stat.IAgriStatsMap in project AgriCraft by AgriCraft.

the class AgriClocheRecipe method getTime.

@Override
public int getTime(ItemStack seed, ItemStack soilStack) {
    IAgriPlant plant = this.getPlant(seed);
    IAgriSoil soil = this.getSoil(soilStack);
    Optional<IAgriStatsMap> statsOptional = this.getStats(seed);
    if (plant.isPlant() && soil.isSoil() && statsOptional.isPresent()) {
        IAgriStatsMap stats = statsOptional.get();
        IAgriGrowthRequirement req = plant.getGrowthRequirement(plant.getInitialGrowthStage());
        int strength = stats.getStrength();
        if (!req.getSoilHumidityResponse(soil.getHumidity(), strength).isFertile()) {
            return Integer.MAX_VALUE;
        }
        if (!req.getSoilAcidityResponse(soil.getAcidity(), strength).isFertile()) {
            return Integer.MAX_VALUE;
        }
        if (!req.getSoilNutrientsResponse(soil.getNutrients(), strength).isFertile()) {
            return Integer.MAX_VALUE;
        }
        double growthFactor = 1 - stats.getGrowth() * this.getGrowthStatFactor();
        double soilFactor = 2 - soil.getGrowthModifier();
        return Math.max((int) (this.getGrowthTicks() * growthFactor * soilFactor), 1);
    }
    return Integer.MAX_VALUE;
}
Also used : IAgriPlant(com.infinityraider.agricraft.api.v1.plant.IAgriPlant) IAgriGrowthRequirement(com.infinityraider.agricraft.api.v1.requirement.IAgriGrowthRequirement) IAgriStatsMap(com.infinityraider.agricraft.api.v1.stat.IAgriStatsMap) IAgriSoil(com.infinityraider.agricraft.api.v1.requirement.IAgriSoil)

Example 2 with IAgriStatsMap

use of com.infinityraider.agricraft.api.v1.stat.IAgriStatsMap in project AgriCraft by AgriCraft.

the class TileEntityCropBase method addServerDebugInfo.

@Override
public void addServerDebugInfo(@Nonnull Consumer<String> consumer) {
    Preconditions.checkNotNull(consumer);
    consumer.accept("CROP:");
    if (this.hasCropSticks()) {
        consumer.accept(" - Crop Sticks Present");
    }
    if (this.isCrossCrop()) {
        consumer.accept(" - This is a cross crop");
    } else {
        final IAgriPlant plant = this.getPlant();
        final IAgriWeed weed = this.getWeeds();
        final IAgriStatsMap stats = this.getStats();
        if (plant.isPlant()) {
            consumer.accept(" - This crop has a plant");
        }
        if (weed.isWeed()) {
            consumer.accept(" - This crop has weeds");
        }
        consumer.accept(" - Plant Id: " + plant.getId());
        consumer.accept(" - Plant Stage: " + this.getGrowthStage());
        consumer.accept(" - Plant Stages: " + plant.getGrowthStages());
        consumer.accept(" - Weed Id: " + weed.getId());
        consumer.accept(" - Weed Stage: " + this.getWeedGrowthStage());
        consumer.accept(" - Weed Stages: " + weed.getGrowthStages());
        consumer.accept(" - stats: " + stats);
        consumer.accept(" - Fertile: " + this.isFertile());
        consumer.accept(" - Mature: " + this.isMature());
        consumer.accept(" - Fully Grown: " + this.isFullyGrown());
        consumer.accept(" - AgriSoil: " + this.getSoil());
    }
}
Also used : IAgriPlant(com.infinityraider.agricraft.api.v1.plant.IAgriPlant) IAgriStatsMap(com.infinityraider.agricraft.api.v1.stat.IAgriStatsMap) IAgriWeed(com.infinityraider.agricraft.api.v1.plant.IAgriWeed)

Aggregations

IAgriPlant (com.infinityraider.agricraft.api.v1.plant.IAgriPlant)2 IAgriStatsMap (com.infinityraider.agricraft.api.v1.stat.IAgriStatsMap)2 IAgriWeed (com.infinityraider.agricraft.api.v1.plant.IAgriWeed)1 IAgriGrowthRequirement (com.infinityraider.agricraft.api.v1.requirement.IAgriGrowthRequirement)1 IAgriSoil (com.infinityraider.agricraft.api.v1.requirement.IAgriSoil)1