Skip to content

Commit ed320cb

Browse files
committed
1.21.11-rc2
1 parent aab355b commit ed320cb

File tree

22 files changed

+151
-149
lines changed

22 files changed

+151
-149
lines changed

build.gradle.kts

Lines changed: 62 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ class ModData {
2222
val modrinth = property("mod.modrinth")
2323
val curseforge = property("mod.curseforge")
2424
val discord = property("mod.discord")
25-
26-
val stable = parseBoolean(property("mod.stable").toString())
27-
28-
val mcVersion = property("mod.mc_version")
29-
val mcVersionRange = property("mod.mc_version_range").toString()
25+
val obfuscated = parseBoolean(property("mod.obfuscated").toString())
26+
val minecraftVersion = property("mod.minecraft_version") as String
27+
val minecraftVersionRange = property("mod.minecraft_version_range") as String
3028
}
3129

3230
class Dependencies {
@@ -35,7 +33,8 @@ class Dependencies {
3533
val fabricApiVersion = property("deps.fabric_api_version").toString()
3634
val mixinconstraintsVersion = property("deps.mixinconstraints_version")
3735
val mixinsquaredVersion = property("deps.mixinsquared_version")
38-
val lightConfigVersion = property("deps.lightconfig")
36+
val lombokVersion = property("deps.lombok_version")
37+
val lightConfigVersion = property("deps.lightconfig_version")
3938
}
4039

4140
class LoaderData {
@@ -48,13 +47,11 @@ val mod = ModData()
4847
val deps = Dependencies()
4948
val loader = LoaderData()
5049

51-
version = "${mod.version}+${mod.mcVersion}-${loader.loader}"
50+
version = "${mod.version}+${mod.minecraftVersion}-${loader.loader}"
5251
group = mod.group
5352
base { archivesName.set(mod.id) }
5453

5554
stonecutter {
56-
constants["fabric"] = loader.isFabric
57-
constants["neoforge"] = loader.isNeoforge
5855
replacements.string {
5956
direction = eval(current.version, ">=1.21.11")
6057
replace("ResourceLocation", "Identifier")
@@ -63,6 +60,7 @@ stonecutter {
6360

6461
blossom {
6562
replaceToken("@MODID@", mod.id)
63+
replaceToken("@VERSION@", mod.version)
6664
}
6765

6866
loom {
@@ -112,19 +110,21 @@ repositories {
112110
}
113111

114112
dependencies {
115-
minecraft("com.mojang:minecraft:${mod.mcVersion}")
113+
minecraft("com.mojang:minecraft:${mod.minecraftVersion}")
116114

117115
@Suppress("UnstableApiUsage")
118116
mappings(loom.layered {
119117
// Mojmap mappings
120118
officialMojangMappings()
121119
// Parchment mappings (it adds parameter mappings & javadoc)
122120
optionalProp("deps.parchment_version") {
123-
var snapshot = !mod.mcVersion.toString().contains(".")
124-
parchment("org.parchmentmc.data:parchment-${if (snapshot) "1.21.10" else mod.mcVersion}:$it@zip")
121+
parchment("org.parchmentmc.data:parchment-${mod.minecraftVersion}:$it@zip")
125122
}
126123
})
127124

125+
compileOnly("org.projectlombok:lombok:${deps.lombokVersion}")
126+
annotationProcessor("org.projectlombok:lombok:${deps.lombokVersion}")
127+
128128
// LightConfig
129129
include(modImplementation("com.github.Legacy-Visuals-Project:LightConfig:${deps.lightConfigVersion}")!!)
130130

@@ -153,16 +153,12 @@ val curseforgeId = findProperty("publish.curseforge")?.toString()?.takeIf { it.i
153153
// modrinth.token=
154154
// curseforge.token=
155155
publishMods {
156-
if (!mod.stable) {
157-
return@publishMods
158-
}
159-
160156
file = project.tasks.remapJar.get().archiveFile
161-
val niceVersionRangeTitle = if (mod.stable && mod.mcVersionRange.contains(' ')) {
162-
val parts = mod.mcVersionRange.trim().split(' ')
157+
val niceVersionRangeTitle = if (mod.minecraftVersionRange.contains(' ')) {
158+
val parts = mod.minecraftVersionRange.trim().split(' ')
163159
parts.first() + '-' + parts.last()
164160
} else {
165-
mod.mcVersionRange
161+
mod.minecraftVersionRange
166162
}
167163

168164
displayName = "Release ${mod.version} for $niceVersionRangeTitle"
@@ -176,7 +172,7 @@ publishMods {
176172
modrinth {
177173
projectId = property("publish.modrinth").toString()
178174
accessToken = findProperty("modrinth.token").toString()
179-
minecraftVersions.addAll(mod.mcVersionRange.split(' '))
175+
minecraftVersions.addAll(mod.minecraftVersionRange.split(' '))
180176
if (loader.isFabric) {
181177
requires("fabric-api")
182178
optional("modmenu")
@@ -188,7 +184,7 @@ publishMods {
188184
curseforge {
189185
projectId = property("publish.curseforge").toString()
190186
accessToken = findProperty("curseforge.token").toString()
191-
minecraftVersions.addAll(mod.mcVersionRange.split(' '))
187+
minecraftVersions.addAll(mod.minecraftVersionRange.split(' '))
192188
if (loader.isFabric) {
193189
requires("fabric-api")
194190
optional("modmenu")
@@ -202,50 +198,59 @@ java {
202198
targetCompatibility = JavaVersion.VERSION_21
203199
}
204200

205-
tasks.processResources {
206-
val props = buildMap {
207-
put("id", mod.id)
208-
put("name", mod.name)
209-
put("version", mod.version)
210-
put("description", mod.description)
211-
put("source", mod.source)
212-
put("issues", mod.issues)
213-
put("license", mod.license)
214-
put("modrinth", mod.modrinth)
215-
put("curseforge", mod.curseforge)
216-
put("discord", mod.discord)
217-
if (loader.isFabric) {
218-
put("fabric_loader_version", deps.fabricLoaderVersion)
219-
}
201+
tasks {
202+
processResources {
203+
val props = buildMap {
204+
put("id", mod.id)
205+
put("name", mod.name)
206+
put("version", mod.version)
207+
put("description", mod.description)
208+
put("source", mod.source)
209+
put("issues", mod.issues)
210+
put("license", mod.license)
211+
put("modrinth", mod.modrinth)
212+
put("curseforge", mod.curseforge)
213+
put("discord", mod.discord)
214+
if (loader.isFabric) {
215+
put("fabric_loader_version", deps.fabricLoaderVersion)
216+
}
220217

221-
if (loader.isNeoforge) {
222-
put("forge_version", deps.neoForgeVersion)
223-
}
218+
if (loader.isNeoforge) {
219+
put("neoforge_version", deps.neoForgeVersion)
220+
}
221+
222+
val minecraftVersionRange = if (mod.minecraftVersionRange.contains(' ')) {
223+
val parts = mod.minecraftVersionRange.trim().split(' ')
224+
">=" + parts.first() + ' ' + "<=" + parts.last()
225+
} else {
226+
mod.minecraftVersionRange
227+
}
224228

225-
val mcVersionRange = if (mod.stable && mod.mcVersionRange.contains(' ')) {
226-
val parts = mod.mcVersionRange.trim().split(' ')
227-
">=" + parts.first() + ' ' + "<=" + parts.last()
228-
} else {
229-
mod.mcVersionRange
229+
put("minecraft_version_range", minecraftVersionRange)
230230
}
231231

232-
put("minecraft_version_range", mcVersionRange)
233-
}
232+
props.forEach(inputs::property)
233+
filesMatching("**/lang/en_us.json") { // Defaults description to English translation
234+
expand(props)
235+
filteringCharset = "UTF-8"
236+
}
234237

235-
props.forEach(inputs::property)
236-
filesMatching("**/lang/en_us.json") { // Defaults description to English translation
237-
expand(props)
238-
filteringCharset = "UTF-8"
239-
}
238+
if (loader.isFabric) {
239+
filesMatching("fabric.mod.json") { expand(props) }
240+
exclude(listOf("META-INF/neoforge.mods.toml"))
241+
}
240242

241-
if (loader.isFabric) {
242-
filesMatching("fabric.mod.json") { expand(props) }
243-
exclude(listOf("META-INF/neoforge.mods.toml"))
243+
if (loader.isNeoforge) {
244+
filesMatching("META-INF/neoforge.mods.toml") { expand(props) }
245+
exclude("fabric.mod.json")
246+
}
244247
}
245248

246-
if (loader.isNeoforge) {
247-
filesMatching("META-INF/neoforge.mods.toml") { expand(props) }
248-
exclude("fabric.mod.json")
249+
register<Copy>("buildAndCollect") {
250+
group = "build"
251+
from(remapJar.map { it.archiveFile }, remapSourcesJar.map { it.archiveFile })
252+
into(rootProject.layout.buildDirectory.file("libs/${project.property("mod.version")}"))
253+
dependsOn("build")
249254
}
250255
}
251256

gradle.properties

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ mod.name=Optiboxes
77
mod.id=optiboxes
88
mod.version=1.8
99
mod.group=btw.lowercase.optiboxes
10-
mod.description=A skybox mod that allows you to use Optifine skies in Fabric 1.21+
11-
mod.source=https://github.com/Legacy-Visuals-Project/Optiboxes
12-
mod.issues=https://github.com/Legacy-Visuals-Project/Optiboxes/issues
10+
mod.description=A skybox mod that allows you to use OptiFine skies in Fabric 1.21+
11+
mod.source=https://github.com/Legacy-Visuals-Project/optiboxes
12+
mod.issues=https://github.com/Legacy-Visuals-Project/optiboxes/issues
1313
mod.license=GPL-3.0-with-linking-exception
1414
mod.modrinth=https://modrinth.com/mod/optiboxes
1515
mod.curseforge=https://legacy.curseforge.com/minecraft/mc-mods/optiboxes
16-
mod.discord=https://discord.gg/zqnXSUqedW
16+
mod.discord=https://discord.gg/C8KKgbA8jy
1717

1818
# Publishing
1919
publish.modrinth=DWuwk8aA
@@ -23,7 +23,8 @@ publish.curseforge=1301799
2323
deps.fabric_loader_version=0.17.3
2424
deps.mixinconstraints_version=1.1.0
2525
deps.mixinsquared_version=0.2.0
26-
deps.lightconfig=7a845fa4ef
26+
deps.lombok_version=1.18.42
27+
deps.lightconfig_version=7a845fa4ef
2728
# 1.0-alpha.1 ---^
2829

2930
# Build Plugins

src/main/java/btw/lowercase/optiboxes/OptiBoxesClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ public void onInitializeClient() {
6464
ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> dispatcher.register(new OptiboxesCommand()));
6565
//? >=1.21.10 {
6666
net.fabricmc.fabric.api.resource.v1.ResourceLoader.get(PackType.CLIENT_RESOURCES).registerReloader(locationOrNull("skybox_reader"), new SkyboxResourceHelper());
67-
//? } else {
67+
//?} else {
6868
/*net.fabricmc.fabric.api.resource.ResourceManagerHelper.get(PackType.CLIENT_RESOURCES).registerReloadListener(new SkyboxResourceHelper());
69-
*///? }
69+
*///?}
7070
}
7171

7272
public static void convert(SkyboxResourceHelper skyboxResourceHelper) {

src/main/java/btw/lowercase/optiboxes/mixins/RenderPipelinesAccessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public interface RenderPipelinesAccessor {
1414
"MATRICES_PROJECTION_SNIPPET"
1515
//?} else {
1616
/*"MATRICES_COLOR_FOG_SNIPPET"
17-
*///? }
17+
*///?}
1818
)
1919
static com.mojang.blaze3d.pipeline.RenderPipeline.Snippet optiboxes$getMatricesProjectionSnippet() {
2020
return null;

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ public class SkyLayerListScreen extends DebugScreen {
1717
private final OptiFineSkybox skybox;
1818

1919
public SkyLayerListScreen(Screen parent, OptiFineSkybox skybox) {
20-
super(Component.literal(skybox.getWorldResourceKey().identifier().toString()), parent);
20+
super(Component.literal(
21+
//? >=1.21.11 {
22+
skybox.getWorldResourceKey().identifier().toString()
23+
//?} else {
24+
/*skybox.getWorldResourceKey().location().toString()
25+
*///?}
26+
), parent);
2127
this.skybox = skybox;
2228
}
2329

src/main/java/btw/lowercase/optiboxes/screen/SkyboxListScreen.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@ protected void init() {
3232
int index = 0;
3333
for (OptiFineSkybox skybox : this.skyboxes) {
3434
scrollableListGidgets.add(new SimpleButton(
35-
Component.literal(skybox.getWorldResourceKey().identifier().toString()),
35+
Component.literal(
36+
//? >=1.21.11 {
37+
skybox.getWorldResourceKey().identifier().toString()
38+
//?} else {
39+
/*skybox.getWorldResourceKey().location().toString()
40+
*///?}
41+
),
3642
(this.width / 2) - (SimpleButton.DEFAULT_WIDTH / 2),
3743
((SimpleButton.DEFAULT_HEIGHT + SimpleButton.DEFAULT_PADDING) * index),
3844
(button) -> this.minecraft.setScreen(new SkyLayerListScreen(this, skybox))

src/main/java/btw/lowercase/optiboxes/skybox/OptiFineSkyLayer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public boolean getConditionCheck(Level level) {
6464
}
6565

6666
if (!(this.biomeInclusion && this.biomes.contains(level.getBiome(cameraEntity.blockPosition()).unwrapKey().orElseThrow()
67-
//? >=1.21.11 {
68-
.identifier()
67+
//? >=1.21.11 {
68+
.identifier()
6969
//?} else {
7070
/*.location()
7171
*///?}

src/main/java/btw/lowercase/optiboxes/skybox/OptiFineSkyRenderer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ private float getTimeOfDay(Level level) {
229229
double frac = Mth.frac(fixedTime / 24000.0 - 0.25);
230230
double mul = 0.5 - Math.cos(frac * Math.PI) / 2.0;
231231
return (float)(frac * 2.0 + mul) / 3.0F;
232-
//? } else {
232+
//?} else {
233233
/*return level.getTimeOfDay(1.0F);
234-
*///? }
234+
*///?}
235235
}
236236
}

src/main/java/btw/lowercase/optiboxes/skybox/OptiFineSkybox.java

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
import com.google.common.collect.ImmutableList;
55
import com.mojang.serialization.Codec;
66
import com.mojang.serialization.codecs.RecordCodecBuilder;
7+
import lombok.Getter;
78
import net.minecraft.client.multiplayer.ClientLevel;
89
import net.minecraft.resources.ResourceKey;
910
import net.minecraft.world.level.Level;
11+
import org.jetbrains.annotations.NotNull;
1012

1113
import java.util.HashMap;
1214
import java.util.List;
@@ -18,10 +20,12 @@ public class OptiFineSkybox {
1820
Level.RESOURCE_KEY_CODEC.fieldOf("world").forGetter(OptiFineSkybox::getWorldResourceKey)
1921
).apply(instance, OptiFineSkybox::new));
2022

23+
@Getter
2124
private final List<OptiFineSkyLayer> layers;
22-
private final ResourceKey<Level> worldResourceKey;
23-
25+
@Getter
26+
private final ResourceKey<@NotNull Level> worldResourceKey;
2427
private final Map<OptiFineSkyLayer, Float> optiFineSkyLayerAlphaMap = new HashMap<>();
28+
@Getter
2529
private boolean active = true;
2630

2731
public OptiFineSkybox(List<OptiFineSkyLayer> layers, ResourceKey<Level> worldResourceKey) {
@@ -39,19 +43,7 @@ public void tick(ClientLevel level) {
3943
}
4044
}
4145

42-
public boolean isActive() {
43-
return this.active;
44-
}
45-
4646
public float getConditionAlphaFor(OptiFineSkyLayer optiFineSkyLayer) {
4747
return this.optiFineSkyLayerAlphaMap.getOrDefault(optiFineSkyLayer, -1.0F);
4848
}
49-
50-
public List<OptiFineSkyLayer> getLayers() {
51-
return this.layers;
52-
}
53-
54-
public ResourceKey<Level> getWorldResourceKey() {
55-
return this.worldResourceKey;
56-
}
5749
}

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,21 @@
22

33
import btw.lowercase.optiboxes.OptiBoxesClient;
44
import com.google.common.base.Preconditions;
5+
import lombok.Getter;
56
import net.minecraft.client.Minecraft;
67
import net.minecraft.client.multiplayer.ClientLevel;
78
import net.minecraft.resources.ResourceKey;
89
import net.minecraft.world.level.Level;
10+
import org.jetbrains.annotations.NotNull;
911

1012
import java.util.ArrayList;
1113
import java.util.LinkedList;
1214
import java.util.List;
1315

1416
public final class SkyboxManager {
1517
public static final SkyboxManager INSTANCE = new SkyboxManager();
16-
1718
private final List<OptiFineSkybox> loadedSkyboxes = new ArrayList<>();
19+
@Getter
1820
private final List<OptiFineSkybox> activeSkyboxes = new LinkedList<>();
1921

2022
private SkyboxManager() {
@@ -48,15 +50,11 @@ public boolean isEnabled(Level level) {
4850
return OptiBoxesClient.getConfig().enabled.isEnabled() && !activeSkyboxes.isEmpty() && level != null;
4951
}
5052

51-
public List<OptiFineSkybox> getSkiesFor(ResourceKey<Level> resourceKey) {
53+
public List<OptiFineSkybox> getSkiesFor(ResourceKey<@NotNull Level> resourceKey) {
5254
return getActiveSkyboxes().stream().filter(skybox -> resourceKey.equals(skybox.getWorldResourceKey())).toList();
5355
}
5456

55-
public boolean containsEnabled(ResourceKey<Level> resourceKey) {
57+
public boolean containsEnabled(ResourceKey<@NotNull Level> resourceKey) {
5658
return !getSkiesFor(resourceKey).isEmpty();
5759
}
58-
59-
public List<OptiFineSkybox> getActiveSkyboxes() {
60-
return this.activeSkyboxes;
61-
}
6260
}

0 commit comments

Comments
 (0)