Some Biome Edge related fixes

This commit is contained in:
Frank 2022-12-05 00:09:21 +01:00
parent 70b3600072
commit 3b00b59f04
3 changed files with 19 additions and 8 deletions

View file

@ -172,7 +172,7 @@ public class BCLBiome extends BCLBiomeSettings implements BiomeData {
Optional<ResourceLocation> biomeParent, Optional<ResourceLocation> biomeParent,
Optional<String> intendedType Optional<String> intendedType
) { ) {
super(terrainHeight, fogDensity, genChance, edgeSize, vertical, edge.map(BiomeAPI::getBiome).orElse(null)); super(terrainHeight, fogDensity, genChance, edgeSize, vertical, edge.orElse(null));
this.biomeID = biomeID; this.biomeID = biomeID;
this.biomeKey = ResourceKey.create(Registries.BIOME, biomeID); this.biomeKey = ResourceKey.create(Registries.BIOME, biomeID);
this.biomeParent = biomeParent.orElse(null); this.biomeParent = biomeParent.orElse(null);
@ -283,6 +283,11 @@ public class BCLBiome extends BCLBiomeSettings implements BiomeData {
return this; return this;
} }
BCLBiome setParent(ResourceLocation parent) {
this.biomeParent = parent;
return this;
}
/** /**
* Set biome edge for this biome instance. If there is already an edge, the * Set biome edge for this biome instance. If there is already an edge, the
* biome is added as subBiome to the current edge-biome * biome is added as subBiome to the current edge-biome

View file

@ -933,13 +933,14 @@ public class BCLBiomeBuilder {
.setEdge(edge) .setEdge(edge)
.setVertical(vertical) .setVertical(vertical)
.build(); .build();
final T res = biomeConstructor.apply(ResourceKey.create(Registries.BIOME, biomeID), settings); final T bclBiome = biomeConstructor.apply(ResourceKey.create(Registries.BIOME, biomeID), settings);
tags.forEach(tagKey -> TagManager.BIOMES.add(tagKey, res.getBiomeKey())); tags.forEach(tagKey -> TagManager.BIOMES.add(tagKey, bclBiome.getBiomeKey()));
SurfaceRuleRegistry.registerRule(biomeID, surfaceRule, biomeID); SurfaceRuleRegistry.registerRule(biomeID, surfaceRule, biomeID);
res.addClimateParameters(parameters); bclBiome.addClimateParameters(parameters);
if (biomeType != null) if (biomeType != null)
res._setIntendedType(biomeType); bclBiome._setIntendedType(biomeType);
BiomeBuilder builder = new BiomeBuilder() BiomeBuilder builder = new BiomeBuilder()
.precipitation(precipitation) .precipitation(precipitation)
@ -949,12 +950,16 @@ public class BCLBiomeBuilder {
builder.mobSpawnSettings(getSpawns().build()); builder.mobSpawnSettings(getSpawns().build());
builder.specialEffects(getEffects().build()); builder.specialEffects(getEffects().build());
if (edge != null) {
edge.setParent(bclBiome.getID());
}
//res.addBiomeTags(tags); //res.addBiomeTags(tags);
//res.setSurface(surfaceRule); //res.setSurface(surfaceRule);
//carvers.forEach(cfg -> BiomeAPI.addBiomeCarver(biome, cfg.second, cfg.first)); //carvers.forEach(cfg -> BiomeAPI.addBiomeCarver(biome, cfg.second, cfg.first));
final UnboundBCLBiome<T> unbound = new UnboundBCLBiome<>( final UnboundBCLBiome<T> unbound = new UnboundBCLBiome<>(
res, bclBiome,
parent, parent,
ctx -> { ctx -> {
BiomeGenerationSettings.Builder genBuilder = getGeneration(ctx); BiomeGenerationSettings.Builder genBuilder = getGeneration(ctx);
@ -962,6 +967,7 @@ public class BCLBiomeBuilder {
return builder.generationSettings(fixGenerationSettings(genBuilder.build())).build(); return builder.generationSettings(fixGenerationSettings(genBuilder.build())).build();
} }
); );
UNBOUND_BIOMES.add(unbound); UNBOUND_BIOMES.add(unbound);
return unbound; return unbound;
} }

View file

@ -110,14 +110,14 @@ public class BCLBiomeSettings {
float genChance, float genChance,
int edgeSize, int edgeSize,
boolean vertical, boolean vertical,
BCLBiome edge ResourceLocation edge
) { ) {
this.terrainHeight = terrainHeight; this.terrainHeight = terrainHeight;
this.fogDensity = fogDensity; this.fogDensity = fogDensity;
this.genChance = genChance; this.genChance = genChance;
this.edgeSize = edgeSize; this.edgeSize = edgeSize;
this.vertical = vertical; this.vertical = vertical;
this.edge = edge == null ? null : edge.getID(); this.edge = edge;
} }
protected BCLBiomeSettings() { protected BCLBiomeSettings() {