Some general fixes

This commit is contained in:
coolGi
2023-08-05 16:53:41 +09:30
parent 42f45f05c3
commit 783ceeb633
4 changed files with 30 additions and 31 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ It should be automatically included when pulling the full mod.
LZ4 for Java (data compression)\ LZ4 for Java (data compression)\
https://github.com/lz4/lz4-java https://github.com/lz4/lz4-java
Json & Toml for Java (config handling)\ NightConfig for Json & Toml (config handling)\
https://github.com/TheElectronWill/night-config https://github.com/TheElectronWill/night-config
SVG Salamander for SVG's\ SVG Salamander for SVG's\
@@ -59,7 +59,7 @@ public class BaseJFrame extends JFrame {
// Creates a list with all the options in it // Creates a list with all the options in it
List<String> langsToChoose = new ArrayList<>(); List<String> langsToChoose = new ArrayList<>();
try( try(
final InputStreamReader isr = new InputStreamReader(JarUtils.accessFile("assets/lod/lang"), StandardCharsets.UTF_8); final InputStreamReader isr = new InputStreamReader(JarUtils.accessFile("assets/distanthorizons/lang"), StandardCharsets.UTF_8);
final BufferedReader br = new BufferedReader(isr) final BufferedReader br = new BufferedReader(isr)
) { ) {
List<Object> col = Collections.unmodifiableList(new ArrayList<>(Arrays.asList(br.lines().toArray()))); List<Object> col = Collections.unmodifiableList(new ArrayList<>(Arrays.asList(br.lines().toArray())));
@@ -87,11 +87,11 @@ public class BaseJFrame extends JFrame {
// Try to set the icons for them // Try to set the icons for them
try { try {
lightMode = new JButton(new ImageIcon( lightMode = new JButton(new ImageIcon(
new FlatSVGIcon(JarUtils.accessFile("assets/lod/textures/jar/themeLight.svg")).getImage() // Get the image new FlatSVGIcon(JarUtils.accessFile("assets/distanthorizons/textures/jar/themeLight.svg")).getImage() // Get the image
.getScaledInstance(themeButtonSize, themeButtonSize, Image.SCALE_DEFAULT) // Scale it to the correct size .getScaledInstance(themeButtonSize, themeButtonSize, Image.SCALE_DEFAULT) // Scale it to the correct size
)); ));
darkMode = new JButton(new ImageIcon( darkMode = new JButton(new ImageIcon(
new FlatSVGIcon(JarUtils.accessFile("assets/lod/textures/jar/themeDark.svg")).getImage() // Get the image new FlatSVGIcon(JarUtils.accessFile("assets/distanthorizons/textures/jar/themeDark.svg")).getImage() // Get the image
.getScaledInstance(themeButtonSize, themeButtonSize, Image.SCALE_DEFAULT) // Scale it to the correct size .getScaledInstance(themeButtonSize, themeButtonSize, Image.SCALE_DEFAULT) // Scale it to the correct size
)); ));
} catch (Exception e) {e.printStackTrace();} } catch (Exception e) {e.printStackTrace();}
@@ -139,8 +139,7 @@ public class BaseJFrame extends JFrame {
// This part of the code is taken from the official java docs at https://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html // This part of the code is taken from the official java docs at https://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
// Specify the look and feel to use by defining the LOOKANDFEEL constant // Specify the look and feel to use by defining the LOOKANDFEEL constant
// Valid values are: null (use the default), "Metal", "System", "Motif", // Valid values are: null (use the default), "Metal", "System", "Motif", and "GTK"
// and "GTK"
final static String LOOKANDFEEL = "GTK"; final static String LOOKANDFEEL = "GTK";
private static void initLookAndFeel() { private static void initLookAndFeel() {
String lookAndFeel = null; String lookAndFeel = null;
@@ -224,7 +224,7 @@
"distanthorizons.config.client.advanced.graphics.noiseTextureSettings.noiseDropoff": "distanthorizons.config.client.advanced.graphics.noiseTextureSettings.noiseDropoff":
"Noise Dropoff", "Noise Dropoff",
"distanthorizons.config.client.advanced.graphics.noiseTextureSettings.noiseDropoff.@tooltip": "distanthorizons.config.client.advanced.graphics.noiseTextureSettings.noiseDropoff.@tooltip":
"How far should the noise texture render before it fades away? \n\n0.0 - the noise texture will render the entire LOD render distance. \n3.0 - the noise texture will fade away at 1/3 of the LOD render distance. ", "Defines how far should the noise texture render before it fades away. (in blocks). \nSet to 0 to disable noise from fading away.",
"distanthorizons.config.client.advanced.graphics.advancedGraphics": "distanthorizons.config.client.advanced.graphics.advancedGraphics":
@@ -104,9 +104,9 @@ void main()
vec3 vertexNormal = normalize(cross(dFdx(vPos.xyz), dFdy(vPos.xyz))); vec3 vertexNormal = normalize(cross(dFdx(vPos.xyz), dFdy(vPos.xyz)));
// This bit of code is required to fix the vertex position problem cus of floats in the verted world position varuable // This bit of code is required to fix the vertex position problem cus of floats in the verted world position varuable
vec3 fixedVPos = vec3( vec3 fixedVPos = vec3(
vPos.x - vertexNormal.x * 0.001, vPos.x - vertexNormal.x * 0.001,
vPos.y - vertexNormal.y * 0.001, vPos.y - vertexNormal.y * 0.001,
vPos.z - vertexNormal.z * 0.001 vPos.z - vertexNormal.z * 0.001
); );
@@ -116,9 +116,9 @@ void main()
// Random value for each position // Random value for each position
float randomValue = rand(vec3( float randomValue = rand(vec3(
quantize(fixedVPos.x, noiseSteps), quantize(fixedVPos.x, noiseSteps),
quantize(fixedVPos.y, noiseSteps), quantize(fixedVPos.y, noiseSteps),
quantize(fixedVPos.z, noiseSteps) quantize(fixedVPos.z, noiseSteps)
)) ))
* 2. * noiseAmplification - noiseAmplification; * 2. * noiseAmplification - noiseAmplification;
@@ -129,22 +129,22 @@ void main()
// Clamps it and turns it back into a vec4 // Clamps it and turns it back into a vec4
if (noiseDropoff == 0) if (noiseDropoff == 0)
fragColor = vec4( fragColor = vec4(
clamp(newCol.r, 0., 1.), clamp(newCol.r, 0., 1.),
clamp(newCol.g, 0., 1.), clamp(newCol.g, 0., 1.),
clamp(newCol.b, 0., 1.), clamp(newCol.b, 0., 1.),
fragColor.w fragColor.w
); );
else else
fragColor = mix( fragColor = mix(
vec4( vec4(
clamp(newCol.r, 0., 1.), clamp(newCol.r, 0., 1.),
clamp(newCol.g, 0., 1.), clamp(newCol.g, 0., 1.),
clamp(newCol.b, 0., 1.), clamp(newCol.b, 0., 1.),
fragColor.w fragColor.w
), fragColor, ), fragColor,
clamp(length(vertexWorldPos) / noiseDropoff, 0., 1.) // The further away it gets, the less noise gets applied clamp(length(vertexWorldPos) / noiseDropoff, 0., 1.) // The further away it gets, the less noise gets applied
); );
// For testing // For testing
// if (fragColor.r != 69420.) { // if (fragColor.r != 69420.) {
@@ -167,15 +167,15 @@ void main()
float horizontalDist = length(vertexWorldPos.xz) * fogScale; float horizontalDist = length(vertexWorldPos.xz) * fogScale;
float heightDist = calculateHeightFogDepth( float heightDist = calculateHeightFogDepth(
vertexWorldPos.y, vertexYPos) * fogVerticalScale; vertexWorldPos.y, vertexYPos) * fogVerticalScale;
float farDist = calculateFarFogDepth(horizontalDist, float farDist = calculateFarFogDepth(horizontalDist,
length(vertexWorldPos.xyz) * fogScale, nearFogStart); length(vertexWorldPos.xyz) * fogScale, nearFogStart);
float nearFogThickness = getNearFogThickness(horizontalDist); float nearFogThickness = getNearFogThickness(horizontalDist);
float farFogThickness = getFarFogThickness(farDist); float farFogThickness = getFarFogThickness(farDist);
float heightFogThickness = getHeightFogThickness(heightDist); float heightFogThickness = getHeightFogThickness(heightDist);
float mixedFogThickness = clamp(mixFogThickness( float mixedFogThickness = clamp(mixFogThickness(
nearFogThickness, farFogThickness, heightFogThickness), 0.0, 1.0); nearFogThickness, farFogThickness, heightFogThickness), 0.0, 1.0);
fragColor = mix(fragColor, vec4(fogColor.rgb, 1.0), mixedFogThickness); fragColor = mix(fragColor, vec4(fogColor.rgb, 1.0), mixedFogThickness);
} }