Converted Biome generation to new BCLib builder
This commit is contained in:
parent
96c65b7bb2
commit
016a3048bd
29 changed files with 871 additions and 618 deletions
|
@ -1,23 +1,63 @@
|
|||
package ru.betterend.world.biome;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import net.minecraft.data.worldgen.StructureFeatures;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import ru.bclib.api.biomes.BCLBiomeBuilder;
|
||||
import ru.bclib.interfaces.StructureFeaturesAccessor;
|
||||
import ru.bclib.world.biomes.BCLBiome;
|
||||
import ru.bclib.world.biomes.BCLBiomeDef;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.registry.EndSounds;
|
||||
|
||||
public class EndBiome extends BCLBiome {
|
||||
public EndBiome(BCLBiomeDef def) {
|
||||
super(updateDef(def));
|
||||
public abstract static class Config {
|
||||
protected static final StructureFeaturesAccessor VANILLA_FEATURES = (StructureFeaturesAccessor)new StructureFeatures();
|
||||
|
||||
public final ResourceLocation ID;
|
||||
|
||||
protected Config(String name) {
|
||||
this.ID = BetterEnd.makeID(name);
|
||||
}
|
||||
|
||||
protected abstract void addCustomBuildData(BCLBiomeBuilder builder);
|
||||
|
||||
public BiFunction<ResourceLocation, Biome, EndBiome> getSupplier(){
|
||||
return EndBiome::new;
|
||||
}
|
||||
|
||||
protected boolean hasCaves(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public EndBiome(ResourceLocation id, Biome biome, float fogDensity, float genChance, boolean hasCaves) {
|
||||
super(id, biome, fogDensity, genChance);
|
||||
this.addCustomData("has_caves", hasCaves);
|
||||
|
||||
public EndBiome(ResourceLocation biomeID, Biome biome) {
|
||||
super(biomeID, biome);
|
||||
}
|
||||
|
||||
private static BCLBiomeDef updateDef(BCLBiomeDef def) {
|
||||
EndFeatures.addDefaultFeatures(def);
|
||||
return def;
|
||||
|
||||
public static EndBiome create(Config biomeConfig){
|
||||
BCLBiomeBuilder builder = BCLBiomeBuilder
|
||||
.start(biomeConfig.ID)
|
||||
.category(Biome.BiomeCategory.THEEND)
|
||||
.music(SoundEvents.MUSIC_END)
|
||||
.waterColor(4159204)
|
||||
.waterFogColor(329011)
|
||||
.fogColor(0xA080A0)
|
||||
.skyColor(0)
|
||||
.mood(EndSounds.AMBIENT_DUST_WASTELANDS)
|
||||
.temperature(0.5f)
|
||||
.wetness(0.5f)
|
||||
.precipitation(Biome.Precipitation.NONE);
|
||||
|
||||
biomeConfig.addCustomBuildData(builder);
|
||||
EndFeatures.addDefaultFeatures(builder, biomeConfig.hasCaves());
|
||||
|
||||
EndBiome biome = builder.build(biomeConfig.getSupplier());
|
||||
biome.addCustomData("has_caves", biomeConfig.hasCaves());
|
||||
|
||||
return biome;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue