Add config option for the new void colour setting!

(I hope I haven't forgotten any place to add it, but it does work, so I don't think so..?)
This commit is contained in:
TechnicJelle 2023-09-30 23:30:59 +02:00
parent 209b4d332a
commit 8cb61df5ac
7 changed files with 31 additions and 1 deletions

View File

@ -363,6 +363,7 @@ private ConfigTemplate createOverworldMapTemplate(String name, Path worldFolder,
.setVariable("sorting", "" + index) .setVariable("sorting", "" + index)
.setVariable("world", formatPath(worldFolder)) .setVariable("world", formatPath(worldFolder))
.setVariable("sky-color", "#7dabff") .setVariable("sky-color", "#7dabff")
.setVariable("void-color", "#000000")
.setVariable("ambient-light", "0.1") .setVariable("ambient-light", "0.1")
.setVariable("world-sky-light", "15") .setVariable("world-sky-light", "15")
.setVariable("remove-caves-below-y", "55") .setVariable("remove-caves-below-y", "55")
@ -376,6 +377,7 @@ private ConfigTemplate createNetherMapTemplate(String name, Path worldFolder, in
.setVariable("sorting", "" + (100 + index)) .setVariable("sorting", "" + (100 + index))
.setVariable("world", formatPath(worldFolder)) .setVariable("world", formatPath(worldFolder))
.setVariable("sky-color", "#290000") .setVariable("sky-color", "#290000")
.setVariable("void-color", "#000000")
.setVariable("ambient-light", "0.6") .setVariable("ambient-light", "0.6")
.setVariable("world-sky-light", "0") .setVariable("world-sky-light", "0")
.setVariable("remove-caves-below-y", "-10000") .setVariable("remove-caves-below-y", "-10000")
@ -389,6 +391,7 @@ private ConfigTemplate createEndMapTemplate(String name, Path worldFolder, int i
.setVariable("sorting", "" + (200 + index)) .setVariable("sorting", "" + (200 + index))
.setVariable("world", formatPath(worldFolder)) .setVariable("world", formatPath(worldFolder))
.setVariable("sky-color", "#080010") .setVariable("sky-color", "#080010")
.setVariable("void-color", "#000000")
.setVariable("ambient-light", "0.6") .setVariable("ambient-light", "0.6")
.setVariable("world-sky-light", "0") .setVariable("world-sky-light", "0")
.setVariable("remove-caves-below-y", "-10000") .setVariable("remove-caves-below-y", "-10000")

View File

@ -49,6 +49,7 @@ public class MapConfig implements MapSettings {
private Vector2i startPos = null; private Vector2i startPos = null;
private String skyColor = "#7dabff"; private String skyColor = "#7dabff";
private String voidColor = "#000000";
private float ambientLight = 0; private float ambientLight = 0;
@ -112,6 +113,11 @@ public String getSkyColor() {
return skyColor; return skyColor;
} }
@Override
public String getVoidColor() {
return voidColor;
}
@Override @Override
public float getAmbientLight() { public float getAmbientLight() {
return ambientLight; return ambientLight;

View File

@ -24,11 +24,16 @@ sorting: ${sorting}
# This defaults to the world-spawn if you don't set it. # This defaults to the world-spawn if you don't set it.
#start-pos: {x:500, z:-820} #start-pos: {x:500, z:-820}
# The color of thy sky as a hex-color # The color of the sky as a hex-color
# You can change this at any time. # You can change this at any time.
# Default is "#7dabff" # Default is "#7dabff"
sky-color: "${sky-color}" sky-color: "${sky-color}"
# The color of the void as a hex-color
# You can change this at any time.
# Default is "#000000"
void-color: "${void-color}"
# Defines the ambient light-strength that every block is receiving, regardless of the sunlight/blocklight. # Defines the ambient light-strength that every block is receiving, regardless of the sunlight/blocklight.
# 0 is no ambient light, 1 is fully lighted. # 0 is no ambient light, 1 is fully lighted.
# You can change this at any time. # You can change this at any time.

View File

@ -394,6 +394,7 @@ export class MapViewer {
this.data.uniforms.distance.value = this.controlsManager.distance; this.data.uniforms.distance.value = this.controlsManager.distance;
this.data.uniforms.skyColor.value = map.data.skyColor; this.data.uniforms.skyColor.value = map.data.skyColor;
this.data.uniforms.voidColor.value = map.data.voidColor;
this.data.uniforms.ambientLight.value = map.data.ambientLight; this.data.uniforms.ambientLight.value = map.data.ambientLight;
this.data.uniforms.hiresTileMap.value.map = map.hiresTileManager.tileMap.texture; this.data.uniforms.hiresTileMap.value.map = map.hiresTileManager.tileMap.texture;
this.data.uniforms.hiresTileMap.value.scale.set(map.data.hires.tileSize.x, map.data.hires.tileSize.z); this.data.uniforms.hiresTileMap.value.scale.set(map.data.hires.tileSize.x, map.data.hires.tileSize.z);

View File

@ -63,6 +63,7 @@ export class Map {
name: id, name: id,
startPos: {x: 0, z: 0}, startPos: {x: 0, z: 0},
skyColor: new Color(), skyColor: new Color(),
voidColor: new Color(),
ambientLight: 0, ambientLight: 0,
hires: { hires: {
tileSize: {x: 32, z: 32}, tileSize: {x: 32, z: 32},
@ -150,6 +151,14 @@ export class Map {
); );
} }
if (worldSettings.voidColor && worldSettings.voidColor.length >= 3) {
this.data.voidColor.setRGB(
worldSettings.voidColor[0],
worldSettings.voidColor[1],
worldSettings.voidColor[2]
);
}
this.data.ambientLight = worldSettings.ambientLight ? worldSettings.ambientLight : this.data.ambientLight; this.data.ambientLight = worldSettings.ambientLight ? worldSettings.ambientLight : this.data.ambientLight;
if (worldSettings.hires === undefined) worldSettings.hires = {}; if (worldSettings.hires === undefined) worldSettings.hires = {};

View File

@ -37,6 +37,8 @@ public interface MapSettings extends RenderSettings {
String getSkyColor(); String getSkyColor();
String getVoidColor();
long getMinInhabitedTime(); long getMinInhabitedTime();
int getMinInhabitedTimeRadius(); int getMinInhabitedTimeRadius();

View File

@ -74,6 +74,10 @@ public JsonElement serialize(BmMap map, Type typeOfSrc, JsonSerializationContext
Color skyColor = new Color().parse(map.getMapSettings().getSkyColor()); Color skyColor = new Color().parse(map.getMapSettings().getSkyColor());
root.add("skyColor", context.serialize(skyColor)); root.add("skyColor", context.serialize(skyColor));
// voidColor
Color voidColor = new Color().parse(map.getMapSettings().getVoidColor());
root.add("voidColor", context.serialize(voidColor));
// ambientLight // ambientLight
root.addProperty("ambientLight", map.getMapSettings().getAmbientLight()); root.addProperty("ambientLight", map.getMapSettings().getAmbientLight());