use of com.ferreusveritas.dynamictrees.api.worldgen.BiomePropertySelectors.IDensitySelector in project DynamicTrees by DynamicTreesTeam.
the class JsonBiomePropertyApplierDensity method readDensitySelector.
private static IDensitySelector readDensitySelector(JsonObject mainObject, Biome biome) {
JsonElement scaleElement = mainObject.get("scale");
if (scaleElement != null && scaleElement.isJsonArray()) {
return createScaleDensitySelector(scaleElement.getAsJsonArray());
}
JsonElement staticElement = mainObject.get("static");
if (staticElement != null && staticElement.isJsonPrimitive() && staticElement.getAsJsonPrimitive().isNumber()) {
return (rnd, n) -> staticElement.getAsJsonPrimitive().getAsFloat();
}
JsonElement mathElement = mainObject.get("math");
if (mathElement != null) {
JsonMath m = new JsonMath(mathElement, biome);
return (rnd, n) -> m.apply(rnd, (float) n);
}
return null;
}
Aggregations