Terrain height setter
This commit is contained in:
parent
717c0d7fb8
commit
6d279852f0
2 changed files with 31 additions and 8 deletions
|
@ -63,6 +63,7 @@ public class BCLBiomeBuilder {
|
||||||
private float fogDensity;
|
private float fogDensity;
|
||||||
private float genChance;
|
private float genChance;
|
||||||
private float downfall;
|
private float downfall;
|
||||||
|
private float height;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts new biome building process.
|
* Starts new biome building process.
|
||||||
|
@ -81,6 +82,7 @@ public class BCLBiomeBuilder {
|
||||||
INSTANCE.fogDensity = 1.0F;
|
INSTANCE.fogDensity = 1.0F;
|
||||||
INSTANCE.downfall = 1.0F;
|
INSTANCE.downfall = 1.0F;
|
||||||
INSTANCE.genChance = 1.0F;
|
INSTANCE.genChance = 1.0F;
|
||||||
|
INSTANCE.height = 0.1F;
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -566,6 +568,16 @@ public class BCLBiomeBuilder {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set terrain height for the biome. Can be used in custom generators, doesn't change vanilla biome distribution or generation.
|
||||||
|
* @param height a relative float terrain height value.
|
||||||
|
* @return same {@link BCLBiomeBuilder} instance.
|
||||||
|
*/
|
||||||
|
public BCLBiomeBuilder terrainHeight(float height) {
|
||||||
|
this.height = height;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finalize biome creation.
|
* Finalize biome creation.
|
||||||
* @return created {@link BCLBiome} instance.
|
* @return created {@link BCLBiome} instance.
|
||||||
|
@ -590,26 +602,27 @@ public class BCLBiomeBuilder {
|
||||||
builder.specialEffects(getEffects().build());
|
builder.specialEffects(getEffects().build());
|
||||||
|
|
||||||
Map<Decoration, List<Supplier<PlacedFeature>>> defferedFeatures = new HashMap<>();
|
Map<Decoration, List<Supplier<PlacedFeature>>> defferedFeatures = new HashMap<>();
|
||||||
BiomeGenerationSettingsAccessor acc = (BiomeGenerationSettingsAccessor)getGeneration().build();
|
BiomeGenerationSettingsAccessor acc = BiomeGenerationSettingsAccessor.class.cast(getGeneration().build());
|
||||||
if (acc!=null){
|
if (acc != null) {
|
||||||
builder.generationSettings(new BiomeGenerationSettings.Builder().build());
|
builder.generationSettings(new BiomeGenerationSettings.Builder().build());
|
||||||
var decorations = acc.bclib_getFeatures();
|
var decorations = acc.bclib_getFeatures();
|
||||||
|
for (Decoration d : Decoration.values()) {
|
||||||
for (Decoration d : Decoration.values()){
|
|
||||||
int i = d.ordinal();
|
int i = d.ordinal();
|
||||||
|
if (i >= 0 && i < decorations.size()) {
|
||||||
if (i>=0 && i<decorations.size()) {
|
|
||||||
var features = decorations.get(i);
|
var features = decorations.get(i);
|
||||||
defferedFeatures.put(d, features.stream().collect(Collectors.toList()));
|
defferedFeatures.put(d, features.stream().collect(Collectors.toList()));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
defferedFeatures.put(d, new ArrayList<>(0));
|
defferedFeatures.put(d, new ArrayList<>(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
builder.generationSettings(getGeneration().build());
|
builder.generationSettings(getGeneration().build());
|
||||||
}
|
}
|
||||||
|
|
||||||
final T res = biomeConstructor.apply(biomeID, builder.build());
|
final T res = biomeConstructor.apply(biomeID, builder.build());
|
||||||
|
res.setTerrainHeight(height);
|
||||||
res.attachStructures(structures);
|
res.attachStructures(structures);
|
||||||
res.setSurface(surfaceRule);
|
res.setSurface(surfaceRule);
|
||||||
res.setFogDensity(fogDensity);
|
res.setFogDensity(fogDensity);
|
||||||
|
|
|
@ -289,6 +289,16 @@ public class BCLBiome {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter for terrain height, can be used in custom terrain generator.
|
||||||
|
* @param terrainHeight a relative float terrain height value.
|
||||||
|
* @return same {@link BCLBiome}.
|
||||||
|
*/
|
||||||
|
public BCLBiome setTerrainHeight(float terrainHeight) {
|
||||||
|
this.terrainHeight = terrainHeight;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for terrain height, can be used in custom terrain generator.
|
* Getter for terrain height, can be used in custom terrain generator.
|
||||||
* @return terrain height.
|
* @return terrain height.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue