use of com.almuradev.content.component.predicate.FunctionPredicate in project Almura by AlmuraDev.
the class Growth method getOrLoadTemperatureRequiredRangeForBiome.
@Nullable
public DoubleRange getOrLoadTemperatureRequiredRangeForBiome(final Biome biome) {
@Nullable DoubleRange found = this.biomeTemperatureRequiredRanges.get(biome);
if (found == null) {
for (final Map.Entry<FunctionPredicate<Biome, ResourceLocation>, DoubleRange> entry : this.biomeTemperatureRequiredPredicates.entrySet()) {
final FunctionPredicate<Biome, ResourceLocation> predicate = entry.getKey();
if (predicate.test(biome)) {
final DoubleRange range = entry.getValue();
this.biomeTemperatureRequiredRanges.put(biome, range);
found = range;
break;
}
}
}
if (found == null && this.globalTemperatureRequiredRange != null) {
this.biomeTemperatureRequiredRanges.put(biome, this.globalTemperatureRequiredRange);
found = this.globalTemperatureRequiredRange;
}
return found;
}
use of com.almuradev.content.component.predicate.FunctionPredicate in project Almura by AlmuraDev.
the class Growth method getOrLoadChanceRangeForBiome.
@Nullable
public DoubleRange getOrLoadChanceRangeForBiome(final Biome biome) {
@Nullable DoubleRange found = this.biomeChanceRanges.get(biome);
if (found == null) {
for (final Map.Entry<FunctionPredicate<Biome, ResourceLocation>, DoubleRange> entry : this.biomeChancePredicates.entrySet()) {
final FunctionPredicate<Biome, ResourceLocation> predicate = entry.getKey();
if (predicate.test(biome)) {
final DoubleRange range = entry.getValue();
this.biomeChanceRanges.put(biome, range);
found = range;
break;
}
}
}
if (found == null && this.globalChanceRange != null) {
this.biomeChanceRanges.put(biome, this.globalChanceRange);
found = this.globalChanceRange;
}
return found;
}
use of com.almuradev.content.component.predicate.FunctionPredicate in project Almura by AlmuraDev.
the class Grass method getOrLoadChanceRangeForBiome.
@Nullable
public DoubleRange getOrLoadChanceRangeForBiome(final Biome biome) {
@Nullable DoubleRange found = this.biomeChanceRanges.get(biome);
if (found == null) {
for (final Map.Entry<FunctionPredicate<Biome, ResourceLocation>, DoubleRange> entry : this.biomeChancePredicates.entrySet()) {
final FunctionPredicate<Biome, ResourceLocation> predicate = entry.getKey();
if (predicate.test(biome)) {
final DoubleRange range = entry.getValue();
this.biomeChanceRanges.put(biome, range);
found = range;
break;
}
}
}
if (found == null && this.globalChanceRange != null) {
this.biomeChanceRanges.put(biome, this.globalChanceRange);
found = this.globalChanceRange;
}
return found;
}
use of com.almuradev.content.component.predicate.FunctionPredicate in project Almura by AlmuraDev.
the class Grass method getOrLoadAmountRequiredRangeForBiome.
@Nullable
public IntRange getOrLoadAmountRequiredRangeForBiome(final Biome biome) {
@Nullable IntRange found = this.biomeAmountRanges.get(biome);
if (found == null) {
for (final Map.Entry<FunctionPredicate<Biome, ResourceLocation>, IntRange> entry : this.biomeAmountPredicates.entrySet()) {
final FunctionPredicate<Biome, ResourceLocation> predicate = entry.getKey();
if (predicate.test(biome)) {
final IntRange range = entry.getValue();
this.biomeAmountRanges.put(biome, range);
found = range;
break;
}
}
}
if (found == null && this.globalAmountRange != null) {
this.biomeAmountRanges.put(biome, this.globalAmountRange);
found = this.globalAmountRange;
}
return found;
}
use of com.almuradev.content.component.predicate.FunctionPredicate in project Almura by AlmuraDev.
the class Growth method getOrLoadLightRangeForBiome.
@Nullable
public DoubleRange getOrLoadLightRangeForBiome(final Biome biome) {
@Nullable DoubleRange found = this.biomeLightRanges.get(biome);
if (found == null) {
for (final Map.Entry<FunctionPredicate<Biome, ResourceLocation>, DoubleRange> entry : this.biomeLightPredicates.entrySet()) {
final FunctionPredicate<Biome, ResourceLocation> predicate = entry.getKey();
if (predicate.test(biome)) {
final DoubleRange range = entry.getValue();
this.biomeLightRanges.put(biome, range);
found = range;
break;
}
}
}
if (found == null && this.globalLightRange != null) {
this.biomeLightRanges.put(biome, this.globalLightRange);
found = this.globalLightRange;
}
return found;
}
Aggregations