Simplified BiomeDecider

This commit is contained in:
Frank 2022-07-08 00:38:35 +02:00
parent c4077a42fd
commit beb2d97304
2 changed files with 37 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -194,6 +194,19 @@ public class BiomeAPI {
if (parentOrNull != null) str += " -> " + parentOrNull;
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);
}
}
/**