Fixed edge and subbiome handling

This commit is contained in:
Frank 2022-12-05 00:28:10 +01:00
parent 3b00b59f04
commit b4494faae5
3 changed files with 14 additions and 11 deletions

View file

@ -278,13 +278,14 @@ public class BCLBiome extends BCLBiomeSettings implements BiomeData {
* @param edge {@link BCLBiome} as the edge biome. * @param edge {@link BCLBiome} as the edge biome.
* @return same {@link BCLBiome}. * @return same {@link BCLBiome}.
*/ */
BCLBiome setEdge(ResourceLocation edge) { BCLBiome setEdgeID(ResourceLocation edge) {
this.edge = edge; this.edge = edge;
return this; return this;
} }
BCLBiome setParent(ResourceLocation parent) { BCLBiome setEdge(BCLBiome edge) {
this.biomeParent = parent; this.edge = edge.biomeID;
edge.biomeParent = this.biomeID;
return this; return this;
} }
@ -292,15 +293,14 @@ public class BCLBiome extends BCLBiomeSettings implements BiomeData {
* 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
* *
* @param edge The new edge * @param newEdge The new edge
* @return same {@link BCLBiome}. * @return same {@link BCLBiome}.
*/ */
public BCLBiome addEdge(BCLBiome edge) { public BCLBiome addEdge(BCLBiome newEdge) {
if (this.edge != null) { if (this.edge != null) {
this.setEdge(edge.biomeID); newEdge.biomeParent = this.edge;
edge.biomeParent = edge.biomeID;
} else { } else {
this.setEdge((ResourceLocation) null); this.setEdge(newEdge);
} }
return this; return this;
} }
@ -327,7 +327,10 @@ public class BCLBiome extends BCLBiomeSettings implements BiomeData {
for (Map.Entry<ResourceKey<BCLBiome>, BCLBiome> entry : reg.entrySet()) { for (Map.Entry<ResourceKey<BCLBiome>, BCLBiome> entry : reg.entrySet()) {
BCLBiome b = entry.getValue(); BCLBiome b = entry.getValue();
if (this.biomeID.equals(entry.getValue().biomeParent)) { if (
this.biomeID.equals(entry.getValue().biomeParent)
&& !entry.getValue().getID().equals(edge)
) {
subbiomes.add(b, b.genChance); subbiomes.add(b, b.genChance);
} }
} }

View file

@ -951,7 +951,7 @@ public class BCLBiomeBuilder {
builder.specialEffects(getEffects().build()); builder.specialEffects(getEffects().build());
if (edge != null) { if (edge != null) {
edge.setParent(bclBiome.getID()); bclBiome.setEdge(edge);
} }
//res.addBiomeTags(tags); //res.addBiomeTags(tags);

View file

@ -204,7 +204,7 @@ public class BCLBiomeSettings {
if (edge != null) { if (edge != null) {
biome.edgeSize = Configs.BIOMES_CONFIG.getInt(group, "edge_size", this.edgeSize); biome.edgeSize = Configs.BIOMES_CONFIG.getInt(group, "edge_size", this.edgeSize);
if (edgeSize > 0) { if (edgeSize > 0) {
biome.setEdge(edge); biome.setEdgeID(edge);
} }
} }