Simplified BiomeDecider
This commit is contained in:
parent
c4077a42fd
commit
beb2d97304
2 changed files with 37 additions and 0 deletions
|
@ -0,0 +1,24 @@
|
||||||
|
package org.betterx.bclib.api.v2.generator;
|
||||||
|
|
||||||
|
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI;
|
||||||
|
|
||||||
|
import net.minecraft.core.Registry;
|
||||||
|
import net.minecraft.world.level.biome.Biome;
|
||||||
|
|
||||||
|
public abstract class TypeBiomeDecider extends BiomeDecider {
|
||||||
|
protected final BiomeAPI.BiomeType assignedType;
|
||||||
|
|
||||||
|
public TypeBiomeDecider(BiomeAPI.BiomeType assignedType) {
|
||||||
|
this(null, assignedType);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected TypeBiomeDecider(Registry<Biome> biomeRegistry, BiomeAPI.BiomeType assignedType) {
|
||||||
|
super(biomeRegistry, (biome) -> biome.getIntendedType().is(assignedType));
|
||||||
|
this.assignedType = assignedType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canProvideBiome(BiomeAPI.BiomeType suggestedType) {
|
||||||
|
return suggestedType.equals(assignedType);
|
||||||
|
}
|
||||||
|
}
|
|
@ -194,6 +194,19 @@ public class BiomeAPI {
|
||||||
if (parentOrNull != null) str += " -> " + parentOrNull;
|
if (parentOrNull != null) str += " -> " + parentOrNull;
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
BiomeType biomeType = (BiomeType) o;
|
||||||
|
return name.equals(biomeType.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue