Skip to content

Commit

Permalink
Change priority to layer
Browse files Browse the repository at this point in the history
  • Loading branch information
AMereBagatelle committed May 15, 2024
1 parent 59f63e6 commit 3cd7029
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<ResourceLocation, Skybox> getSkyboxMap() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.joml.Matrix4f;

public interface Skybox {
default int getPriority() {
default int getLayer() {
return 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void renderHud(GuiGraphics drawContext) {
for (Map.Entry<ResourceLocation, Skybox> 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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class Properties {
public static final Codec<Properties> 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),
Expand All @@ -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;
Expand All @@ -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);
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ public float getAlpha() {
}

@Override
public int getPriority() {
return this.properties.getPriority();
public int getLayer() {
return this.properties.getLayer();
}

@Override
Expand Down

0 comments on commit 3cd7029

Please sign in to comment.