From 3cd70293129c2f41012866ed01144d3a9d33b8c4 Mon Sep 17 00:00:00 2001 From: AMereBagatelle Date: Wed, 15 May 2024 11:26:23 -0400 Subject: [PATCH] Change priority to layer --- .../amerebagatelle/mods/nuit/SkyboxManager.java | 2 +- .../mods/nuit/api/skyboxes/Skybox.java | 2 +- .../mods/nuit/screen/SkyboxDebugScreen.java | 2 +- .../amerebagatelle/mods/nuit/skybox/Properties.java | 12 ++++++------ .../mods/nuit/skyboxes/AbstractSkybox.java | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/common/src/main/java/io/github/amerebagatelle/mods/nuit/SkyboxManager.java b/common/src/main/java/io/github/amerebagatelle/mods/nuit/SkyboxManager.java index 8f1bb467..c4c4cfcb 100644 --- a/common/src/main/java/io/github/amerebagatelle/mods/nuit/SkyboxManager.java +++ b/common/src/main/java/io/github/amerebagatelle/mods/nuit/SkyboxManager.java @@ -130,7 +130,7 @@ public void tick(ClientLevel level) { this.activeSkyboxes.add(skybox); } } - this.activeSkyboxes.sort(Comparator.comparingInt(Skybox::getPriority)); + this.activeSkyboxes.sort(Comparator.comparingInt(Skybox::getLayer)); } public Map getSkyboxMap() { diff --git a/common/src/main/java/io/github/amerebagatelle/mods/nuit/api/skyboxes/Skybox.java b/common/src/main/java/io/github/amerebagatelle/mods/nuit/api/skyboxes/Skybox.java index 503edb40..bb5990e6 100644 --- a/common/src/main/java/io/github/amerebagatelle/mods/nuit/api/skyboxes/Skybox.java +++ b/common/src/main/java/io/github/amerebagatelle/mods/nuit/api/skyboxes/Skybox.java @@ -7,7 +7,7 @@ import org.joml.Matrix4f; public interface Skybox { - default int getPriority() { + default int getLayer() { return 0; } diff --git a/common/src/main/java/io/github/amerebagatelle/mods/nuit/screen/SkyboxDebugScreen.java b/common/src/main/java/io/github/amerebagatelle/mods/nuit/screen/SkyboxDebugScreen.java index 446db2bd..2349c91c 100644 --- a/common/src/main/java/io/github/amerebagatelle/mods/nuit/screen/SkyboxDebugScreen.java +++ b/common/src/main/java/io/github/amerebagatelle/mods/nuit/screen/SkyboxDebugScreen.java @@ -34,7 +34,7 @@ public void renderHud(GuiGraphics drawContext) { for (Map.Entry identifierSkyboxEntry : SkyboxManager.getInstance().getSkyboxMap().entrySet()) { Skybox activeSkybox = identifierSkyboxEntry.getValue(); if (activeSkybox instanceof NuitSkybox nuitSkybox && nuitSkybox.isActive()) { - drawContext.drawString(Minecraft.getInstance().font, identifierSkyboxEntry.getKey() + " " + activeSkybox.getPriority() + " " + nuitSkybox.getAlpha(), 2, yPadding, 0xffffffff, false); + drawContext.drawString(Minecraft.getInstance().font, identifierSkyboxEntry.getKey() + " " + activeSkybox.getLayer() + " " + nuitSkybox.getAlpha(), 2, yPadding, 0xffffffff, false); yPadding += 14; } } diff --git a/common/src/main/java/io/github/amerebagatelle/mods/nuit/skybox/Properties.java b/common/src/main/java/io/github/amerebagatelle/mods/nuit/skybox/Properties.java index 58ee23b7..07625665 100644 --- a/common/src/main/java/io/github/amerebagatelle/mods/nuit/skybox/Properties.java +++ b/common/src/main/java/io/github/amerebagatelle/mods/nuit/skybox/Properties.java @@ -7,7 +7,7 @@ public class Properties { public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( - Codec.INT.optionalFieldOf("priority", 0).forGetter(Properties::getPriority), + Codec.INT.optionalFieldOf("layer", 0).forGetter(Properties::getLayer), Fade.CODEC.fieldOf("fade").forGetter(Properties::getFade), CodecUtils.getClampedFloat(0F, 1.0F).optionalFieldOf("minAlpha", 0F).forGetter(Properties::getMaxAlpha), CodecUtils.getClampedFloat(0F, 1.0F).optionalFieldOf("maxAlpha", 1.0F).forGetter(Properties::getMaxAlpha), @@ -23,7 +23,7 @@ public class Properties { public static final Properties DEFAULT = new Properties(0, Fade.DEFAULT, 0F, 1F, 20, 20, false, false, RGBA.DEFAULT, true, true, Rotation.DEFAULT); - private final int priority; + private final int layer; private final Fade fade; private final float minAlpha; private final float maxAlpha; @@ -36,8 +36,8 @@ public class Properties { private final boolean renderInThickFog; private final Rotation rotation; - public Properties(int priority, Fade fade, float minAlpha, float maxAlpha, int transitionInDuration, int transitionOutDuration, boolean changeFog, boolean changeFogDensity, RGBA fogColors, boolean renderSunSkyTint, boolean renderInThickFog, Rotation rotation) { - this.priority = priority; + public Properties(int layer, Fade fade, float minAlpha, float maxAlpha, int transitionInDuration, int transitionOutDuration, boolean changeFog, boolean changeFogDensity, RGBA fogColors, boolean renderSunSkyTint, boolean renderInThickFog, Rotation rotation) { + this.layer = layer; this.fade = fade; if (minAlpha > maxAlpha) { throw new IllegalStateException("Maximum alpha is lower than the minimum alpha:\n" + this); @@ -54,8 +54,8 @@ public Properties(int priority, Fade fade, float minAlpha, float maxAlpha, int t this.rotation = rotation; } - public int getPriority() { - return priority; + public int getLayer() { + return layer; } public Fade getFade() { diff --git a/common/src/main/java/io/github/amerebagatelle/mods/nuit/skyboxes/AbstractSkybox.java b/common/src/main/java/io/github/amerebagatelle/mods/nuit/skyboxes/AbstractSkybox.java index 3fab2ca3..04dc45f2 100644 --- a/common/src/main/java/io/github/amerebagatelle/mods/nuit/skyboxes/AbstractSkybox.java +++ b/common/src/main/java/io/github/amerebagatelle/mods/nuit/skyboxes/AbstractSkybox.java @@ -329,8 +329,8 @@ public float getAlpha() { } @Override - public int getPriority() { - return this.properties.getPriority(); + public int getLayer() { + return this.properties.getLayer(); } @Override