Skip to content

Commit a81869c

Browse files
committed
Start 2.6 cycle
1 parent 56a01f3 commit a81869c

16 files changed

Lines changed: 88 additions & 107 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,5 @@
1-
# Release 2.5
1+
# Release 2.6
22

33
### General
44

5-
- Fix biomes parsing ("minecraft:plains" is now valid)
6-
- Removed "optiboxes" command alias ("/skyboxify" is the only command now)
7-
- Increased Skybox size
8-
- View-bobbing seems to affect it less when bigger
9-
- Fixes random far/near clipping
10-
- 1.21.2/3 & 1.21.4 now use the "custom_skybox" custom core shader for sky rendering
11-
- Config screen now shows current version & commit in top right
12-
13-
### Experimental
14-
15-
- New API v0
16-
- Get instance via SkyboxifyImpl#getInstance returns SkyboxifyApi
17-
- SkyboxifyApi#getConfig
18-
- Returns the Skyboxify config instance
19-
- SkyboxifyApi#getSkyboxManager
20-
- Returns the Skybox manager class that handles inactive/active skyboxes & handling
21-
- SkyboxifyApi#registerDimensionMapping(int legacyId, Identifier modernId)
22-
- for other mods to use to map their older dimension ids to their modern counterpart
23-
- will throw exception if legacy id is already taken or if modern id is already assigned a value
24-
- world-1 is classified by default as "minecraft:the_nether" dimension
25-
- world0 is classified by default as "minecraft:overworld" dimension
26-
- world1 is classified by default as "minecraft:the_end" dimension
27-
- world4 is classified by default as "aether:the_aether" dimension
28-
- world7 is classified by default as "twilightforest:twilight_forest" dimension
29-
- SkyboxifyApi#getModernDimension(int legacyId)
30-
- Returns mapped modern identifier or null if none
31-
- SkyboxifyApi#getApiVersion
32-
- Returns current api version (currently 0)
33-
34-
### Debug
35-
36-
- "daysLoop" is now always parsed even when "days" is empty (for debugging purposes)
37-
- "axis" is now pretty printed in the debug sky layer info screen
38-
- Added debug "dump" command which exports the active skyboxes into the "debug_skyboxify" folder
39-
- The data is the encoded value of the stored data via the CODEC
40-
- NOTE: If any value is the same as the default value, it won’t be encoded
41-
- Debug menu now shows file name instead of source texture path
42-
- NOTE: Texture is still shown as top line of data
5+
- Stars no longer render if an active Skybox pack is present, unless the setting is turned on.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ org.gradle.parallel=true
55
# Mod properties
66
mod.name=Skyboxify
77
mod.id=skyboxify
8-
mod.version=2.5
8+
mod.version=2.6
99
mod.group=btw.lowercase
1010
mod.description=A skybox mod that allows you to use OptiFine skies in Fabric 1.21+
1111
mod.source=https://github.com/Legacy-Visuals-Project/Skyboxify

src/main/java/btw/lowercase/skyboxify/Skyboxify.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,14 @@
3333
import com.mojang.math.Axis;
3434
import lombok.Getter;
3535
import lombok.experimental.UtilityClass;
36-
import net.minecraft.client.Minecraft;
3736
import net.minecraft.client.multiplayer.ClientLevel;
3837
import net.minecraft.resources.Identifier;
3938
import net.minecraft.world.level.Level;
4039
import org.joml.Matrix4f;
41-
import org.slf4j.Logger;
42-
import org.slf4j.LoggerFactory;
4340
import org.visuals.legacy.lightconfig.lib.v1.events.EventManager;
4441

45-
import java.nio.file.Path;
46-
4742
@UtilityClass
4843
public class Skyboxify {
49-
public final Path DEBUG_FOLDER = Minecraft.getInstance().gameDirectory.toPath().resolve("debug_" + SkyboxifyInfo.MOD_ID);
50-
@Getter
51-
private final Logger logger = LoggerFactory.getLogger(Skyboxify.class);
5244
@Getter
5345
private final EventManager globalEventManager = new EventManager();
5446

@@ -65,8 +57,15 @@ public void initialize() {
6557
globalEventManager.listen(SkyRenderEvent.Celestial.class, event -> {
6658
if (config.enabled.isEnabled()) {
6759
final SkyRenderEvent.Celestial.Type type = event.getType();
68-
if ((!config.renderSunMoon.isEnabled() && (type == SkyRenderEvent.Celestial.Type.SUN || type == SkyRenderEvent.Celestial.Type.MOON))
69-
|| (!config.renderStars.isEnabled() && type == SkyRenderEvent.Celestial.Type.STARS)) {
60+
if (!config.renderSunMoon.isEnabled() && (type == SkyRenderEvent.Celestial.Type.SUN || type == SkyRenderEvent.Celestial.Type.MOON)) {
61+
event.setCancelled(true);
62+
}
63+
64+
if (SkyboxifyImpl.skyboxManager().isEnabled() && type == SkyRenderEvent.Celestial.Type.STARS) {
65+
if (config.renderStars.isEnabled()) {
66+
return;
67+
}
68+
7069
event.setCancelled(true);
7170
}
7271
}
@@ -100,7 +99,7 @@ public void initialize() {
10099

101100
private void renderSkyboxes(final ClientLevel level, final float tickDelta) {
102101
final Matrix4f modelViewMatrix = new Matrix4f(RenderSystem.getModelViewStack()).rotate(Axis.YP.rotationDegrees(-90.0F));
103-
for (final Skybox skybox : SkyboxifyImpl.skyboxManager().getActive()) {
102+
for (final Skybox skybox : SkyboxifyImpl.skyboxManager().getActiveSkies()) {
104103
SkyboxRenderer.INSTANCE.render(skybox, modelViewMatrix, level, tickDelta);
105104
}
106105
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
package btw.lowercase.skyboxify;
22

3+
import net.minecraft.client.Minecraft;
4+
5+
import java.nio.file.Path;
6+
37
public final class SkyboxifyInfo {
48
public static final String MOD_ID = "@MODID@";
59
public static final String VERSION = "@VERSION@";
610
public static final String COMMIT = "@COMMIT@";
11+
12+
public static final Path DEBUG_FOLDER = Minecraft.getInstance().gameDirectory.toPath().resolve("debug_" + SkyboxifyInfo.MOD_ID);
713
}

src/main/java/btw/lowercase/skyboxify/api/SkyboxifyImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public Identifier getModernDimension(final int legacyId) {
7676
@Override
7777
public void registerDimensionMapping(final int legacyId, final Identifier modernId) {
7878
if (this.dimensionMapping.containsKey(legacyId)) {
79-
throw new IllegalArgumentException("Cannot register dimension mapping, world with legacy id " + legacyId + " is already taken by \"" + dimensionMapping.get(legacyId) + "\"!");
79+
throw new IllegalArgumentException("Cannot register dimension mapping, world with legacy properties " + legacyId + " is already taken by \"" + dimensionMapping.get(legacyId) + "\"!");
8080
}
8181

8282
if (this.dimensionMapping.containsValue(modernId)) {
@@ -87,7 +87,7 @@ public void registerDimensionMapping(final int legacyId, final Identifier modern
8787
}
8888
}
8989

90-
throw new IllegalArgumentException("Cannot register dimension mapping, world \"" + modernId + "\" is already mapped to legacy id " + currentId);
90+
throw new IllegalArgumentException("Cannot register dimension mapping, world \"" + modernId + "\" is already mapped to legacy properties " + currentId);
9191
}
9292

9393
this.dimensionMapping.put(legacyId, modernId);

src/main/java/btw/lowercase/skyboxify/command/SkyboxifyCommand.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
package btw.lowercase.skyboxify.command;
2525

26-
import btw.lowercase.skyboxify.Skyboxify;
26+
import btw.lowercase.skyboxify.SkyboxifyInfo;
2727
import btw.lowercase.skyboxify.api.SkyboxifyImpl;
2828
import btw.lowercase.skyboxify.screen.SkyboxListScreen;
2929
import btw.lowercase.skyboxify.skybox.SkyLayer;
@@ -68,7 +68,7 @@ private static class Debug implements Command<FabricClientCommandSource> {
6868
@Override
6969
public int run(final CommandContext<FabricClientCommandSource> context) {
7070
final Minecraft minecraft = Minecraft.getInstance();
71-
minecraft.schedule(() -> minecraft.setScreen(new SkyboxListScreen(minecraft.screen, SkyboxifyImpl.skyboxManager().getLoaded())));
71+
minecraft.schedule(() -> minecraft.setScreen(new SkyboxListScreen(minecraft.screen, SkyboxifyImpl.skyboxManager().getLoadedSkies())));
7272
return Command.SINGLE_SUCCESS;
7373
}
7474
}
@@ -77,16 +77,16 @@ private static class Dump implements Command<FabricClientCommandSource> {
7777
@SneakyThrows
7878
@Override
7979
public int run(final CommandContext<FabricClientCommandSource> context) {
80-
if (!Files.isDirectory(Skyboxify.DEBUG_FOLDER)) {
81-
Files.delete(Skyboxify.DEBUG_FOLDER);
80+
if (!Files.isDirectory(SkyboxifyInfo.DEBUG_FOLDER)) {
81+
Files.delete(SkyboxifyInfo.DEBUG_FOLDER);
8282
}
8383

84-
if (!Files.exists(Skyboxify.DEBUG_FOLDER)) {
85-
Files.createDirectories(Skyboxify.DEBUG_FOLDER);
84+
if (!Files.exists(SkyboxifyInfo.DEBUG_FOLDER)) {
85+
Files.createDirectories(SkyboxifyInfo.DEBUG_FOLDER);
8686
}
8787

88-
for (final Skybox skybox : SkyboxifyImpl.skyboxManager().getLoaded()) {
89-
final Path packFolder = Skyboxify.DEBUG_FOLDER.resolve(skybox.getPackName().replaceAll("/", "+").replaceAll(" ", "_"));
88+
for (final Skybox skybox : SkyboxifyImpl.skyboxManager().getLoadedSkies()) {
89+
final Path packFolder = SkyboxifyInfo.DEBUG_FOLDER.resolve(skybox.getPackName().replaceAll("/", "+").replaceAll(" ", "_"));
9090
if (!Files.exists(packFolder)) {
9191
Files.createDirectory(packFolder);
9292
}
@@ -99,7 +99,7 @@ public int run(final CommandContext<FabricClientCommandSource> context) {
9999

100100
for (final SkyLayer layer : skybox.getLayers()) {
101101
try {
102-
String id = Path.of(layer.id().getPath()).getFileName().toString();
102+
String id = Path.of(layer.properties().getPath()).getFileName().toString();
103103
if (id.endsWith(".properties")) {
104104
id = id.substring(0, id.length() - 11);
105105
}
@@ -115,13 +115,13 @@ public int run(final CommandContext<FabricClientCommandSource> context) {
115115

116116
Files.writeString(dimensionFolder.resolve(id + ".json"), GSON.toJson(element));
117117
} catch (final IOException exception) {
118-
error(context, "Failed to encode layer " + layer.id());
118+
error(context, "Failed to encode layer " + layer.properties());
119119
error(context, exception.toString());
120120
}
121121
}
122122
}
123123

124-
success(context, "Active Skybox's have been dumped to " + Skyboxify.DEBUG_FOLDER);
124+
success(context, "Active Skybox's have been dumped to " + SkyboxifyInfo.DEBUG_FOLDER);
125125
return Command.SINGLE_SUCCESS;
126126
}
127127
}

src/main/java/btw/lowercase/skyboxify/config/SkyboxifyConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
public class SkyboxifyConfig extends Config {
3434
public final BooleanConfigField enabled = this.booleanFieldOf("enabled", true);
3535
public final BooleanConfigField renderSunMoon = this.booleanFieldOf("renderSunMoon", true);
36-
public final BooleanConfigField renderStars = this.booleanFieldOf("renderStars", true);
36+
public final BooleanConfigField renderStars = this.booleanFieldOf("renderStars", false);
3737
public final BooleanConfigField showOverworldForUnknownDimension = this.booleanFieldOf("showOverworldForUnknownDimension", true);
3838
public final BooleanConfigField debug = this.booleanFieldOf("debug", false);
3939
public final BooleanConfigField legacyRotationLogic = this.booleanFieldOf("legacyRotationLogic", false);

src/main/java/btw/lowercase/skyboxify/screen/SkyLayerListScreen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ protected void init() {
5555

5656
final List<Gidget> gidgets = new ArrayList<>();
5757
for (final SkyLayer skyLayer : this.skybox.getLayers()) {
58-
final Component title = Component.literal(skyLayer.id().toString());
58+
final Component title = Component.literal(skyLayer.properties().toString());
5959
gidgets.add(SimpleButton.builder(title, button -> this.minecraft.setScreen(new SkyLayerInfoScreen(this, skyLayer, title))).build());
6060
}
6161

src/main/java/btw/lowercase/skyboxify/skybox/SkyLayer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
import java.util.List;
4343

4444
public record SkyLayer(
45-
Identifier id,
45+
Identifier properties,
4646
Identifier texture,
4747
Biomes biomes,
4848
List<Range> heights,
@@ -56,7 +56,7 @@ public record SkyLayer(
5656
List<Weather> weatherConditions
5757
) {
5858
public static final Codec<SkyLayer> CODEC = RecordCodecBuilder.create(instance -> instance.group(
59-
Identifier.CODEC.fieldOf("_id").forGetter(SkyLayer::id),
59+
Identifier.CODEC.fieldOf("properties").forGetter(SkyLayer::properties),
6060
Identifier.CODEC.fieldOf("texture").forGetter(SkyLayer::texture),
6161
Biomes.CODEC.optionalFieldOf("biomes", Biomes.DEFAULT).forGetter(SkyLayer::biomes),
6262
Range.CODEC.listOf().optionalFieldOf("heights", ImmutableList.of()).forGetter(SkyLayer::heights),
@@ -84,7 +84,7 @@ private boolean getConditionCheck(final ClientLevel level) {
8484
}
8585
}
8686

87-
return this.heights == null || CommonUtils.checkRanges(entityPos.getY(), this.heights);
87+
return this.heights == null || this.heights.isEmpty() || Range.contains(this.heights, entityPos.getY());
8888
}
8989

9090
public float getPositionBrightness(final ClientLevel level, final float conditionAlpha) {
@@ -108,7 +108,7 @@ public boolean isActive(final long dayTime, final int clampedTimeOfDay) {
108108

109109
final int daysPassed = (int) (adjustedTime / 24000L);
110110
final int currentDay = daysPassed % this.loop.days();
111-
return CommonUtils.checkRanges(currentDay, this.loop.ranges());
111+
return this.loop.ranges().isEmpty() || Range.contains(this.loop.ranges(), currentDay);
112112
} else {
113113
return true;
114114
}

src/main/java/btw/lowercase/skyboxify/skybox/SkyboxManager.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737

3838
public final class SkyboxManager {
3939
@Getter
40-
private final List<Skybox> loaded = new ArrayList<>();
40+
private final List<Skybox> loadedSkies = new ArrayList<>();
4141
@Getter
42-
private final List<Skybox> active = new LinkedList<>();
42+
private final List<Skybox> activeSkies = new LinkedList<>();
4343
private final SkyboxifyApi api;
4444

4545
public SkyboxManager(final SkyboxifyApi api) {
@@ -48,33 +48,33 @@ public SkyboxManager(final SkyboxifyApi api) {
4848

4949
public void addSkybox(final Skybox skybox) {
5050
if (this.api.getConfig().enabled.isEnabled()) {
51-
this.loaded.add(Preconditions.checkNotNull(skybox, "Skybox was null"));
51+
this.loadedSkies.add(Preconditions.checkNotNull(skybox, "Skybox was null"));
5252
}
5353
}
5454

5555
public void clearSkyboxes() {
5656
SkyboxRenderer.INSTANCE.clearCache();
57-
this.loaded.clear();
58-
this.active.clear();
57+
this.loadedSkies.clear();
58+
this.activeSkies.clear();
5959
}
6060

6161
public void tick(final ClientLevel level) {
6262
if (this.api.getConfig().enabled.isEnabled()) {
63-
for (final Skybox skybox : this.loaded) {
63+
for (final Skybox skybox : this.loadedSkies) {
6464
skybox.tick(level);
6565
}
6666

67-
this.active.removeIf(optiFineSkybox -> !optiFineSkybox.isActive());
68-
this.loaded.stream().filter(it -> !this.active.contains(it) && it.isActive()).forEach(this.active::add);
67+
this.activeSkies.removeIf(optiFineSkybox -> !optiFineSkybox.isActive());
68+
this.loadedSkies.stream().filter(it -> !this.activeSkies.contains(it) && it.isActive()).forEach(this.activeSkies::add);
6969
}
7070
}
7171

7272
public boolean isEnabled() {
73-
return this.api.getConfig().enabled.isEnabled() && !this.active.isEmpty();
73+
return this.api.getConfig().enabled.isEnabled() && !this.activeSkies.isEmpty();
7474
}
7575

7676
public List<Skybox> getSkiesFor(final ResourceKey<@NotNull Level> resourceKey) {
77-
return getActive().stream().filter(skybox -> resourceKey.equals(skybox.getDimension())).toList();
77+
return getActiveSkies().stream().filter(skybox -> resourceKey.equals(skybox.getDimension())).toList();
7878
}
7979

8080
public boolean containsEnabled(final ResourceKey<@NotNull Level> resourceKey) {

0 commit comments

Comments
 (0)