Skip to content

Commit

Permalink
Serialize custom water format with JsonUtil.
Browse files Browse the repository at this point in the history
  • Loading branch information
leMaik committed Oct 19, 2024
1 parent c7a251d commit 1a01174
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions chunky/src/java/se/llbit/chunky/renderer/scene/Scene.java
Original file line number Diff line number Diff line change
Expand Up @@ -2568,11 +2568,7 @@ public void setUseCustomWaterColor(boolean value) {
json.add("waterVisibility", waterVisibility);
json.add("useCustomWaterColor", useCustomWaterColor);
if (useCustomWaterColor) {
JsonObject colorObj = new JsonObject();
colorObj.add("red", waterColor.x);
colorObj.add("green", waterColor.y);
colorObj.add("blue", waterColor.z);
json.add("waterColor", colorObj);
json.add("waterColor", JsonUtil.rgbToJson(waterColor));
}
currentWaterShader.save(json);
json.add("fog", fog.toJson());
Expand Down Expand Up @@ -2877,10 +2873,7 @@ else if(waterShader.equals("SIMPLEX"))
waterVisibility = json.get("waterVisibility").doubleValue(waterVisibility);
useCustomWaterColor = json.get("useCustomWaterColor").boolValue(useCustomWaterColor);
if (useCustomWaterColor) {
JsonObject colorObj = json.get("waterColor").object();
waterColor.x = colorObj.get("red").doubleValue(waterColor.x);
waterColor.y = colorObj.get("green").doubleValue(waterColor.y);
waterColor.z = colorObj.get("blue").doubleValue(waterColor.z);
JsonUtil.rgbFromJson(json.get("waterColor"), waterColor);
}
biomeColors = json.get("biomeColorsEnabled").boolValue(biomeColors);
transparentSky = json.get("transparentSky").boolValue(transparentSky);
Expand Down

0 comments on commit 1a01174

Please sign in to comment.