use of com.infinityraider.agricraft.farming.growthrequirement.GrowthReqBuilder in project AgriCraft by AgriCraft.
the class JsonPlant method initGrowthRequirementJSON.
public static final IGrowthRequirement initGrowthRequirementJSON(AgriPlant plant) {
IGrowthReqBuilder builder = new GrowthReqBuilder();
if (plant == null) {
return builder.build();
}
if (plant.getRequirement().getSoils().isEmpty()) {
AgriCore.getLogger("agricraft").warn("Plant: \"{0}\" has no valid soils to plant on!", plant.getPlantName());
}
plant.getRequirement().getSoils().stream().map(JsonSoil::new).forEach(builder::addSoil);
plant.getRequirement().getConditions().forEach(obj -> {
final Object stack = obj.toStack();
if (stack instanceof FuzzyStack) {
builder.addCondition(new BlockCondition((FuzzyStack) stack, new BlockRange(obj.getMinX(), obj.getMinY(), obj.getMinZ(), obj.getMaxX(), obj.getMaxY(), obj.getMaxZ())));
}
});
builder.setMinLight(plant.getRequirement().getMinLight());
builder.setMaxLight(plant.getRequirement().getMaxLight());
return builder.build();
}
Aggregations