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<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.biomeKey = ResourceKey.create(Registries.BIOME, biomeID);
this.biomeParent = biomeParent.orElse(null);
@ -283,6 +283,11 @@ public class BCLBiome extends BCLBiomeSettings implements BiomeData {
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
* biome is added as subBiome to the current edge-biome

View file

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

View file

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