Skip to content

Commit 5bfa047

Browse files
authored
Merge pull request #11 from cxntered/fix/awe
port to 1.21.11
2 parents df893f0 + 8833853 commit 5bfa047

18 files changed

Lines changed: 222 additions & 124 deletions

build.gradle.kts

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@ plugins {
55
id("net.fabricmc.fabric-loom-remap") version "1.14-SNAPSHOT"
66
id("org.jetbrains.kotlin.jvm") version "2.3.0"
77
id("dev.deftu.gradle.bloom") version "0.2.0"
8+
id("me.modmuss50.mod-publish-plugin") version "1.1.0"
89
}
910

1011
val modid = property("mod.id")
1112
val modname = property("mod.name")
1213
val modversion = property("mod.version")
13-
val mcversion = property("minecraft_version")
14+
val mcversion = stonecutter.current.version
15+
val oneconfigversion = property("oneconfig_version")
1416

15-
base {
16-
archivesName.set(property("mod.id") as String)
17-
}
17+
version = "$modversion+$mcversion"
18+
base.archivesName = modname.toString()
1819

1920
repositories {
2021
maven("https://maven.parchmentmc.org")
@@ -33,27 +34,22 @@ loom {
3334
}
3435

3536
dependencies {
36-
minecraft("com.mojang:minecraft:${property("minecraft_version")}")
37+
minecraft("com.mojang:minecraft:$mcversion")
3738
@Suppress("UnstableApiUsage")
3839
mappings(loom.layered {
3940
officialMojangMappings()
4041
optionalProp("${property("parchment_version")}") {
41-
parchment("org.parchmentmc.data:parchment-${property("minecraft_version")}:$it@zip")
42+
parchment("org.parchmentmc.data:parchment-$mcversion:$it@zip")
4243
}
4344
optionalProp("${property("yalmm_version")}") {
44-
mappings("dev.lambdaurora:yalmm-mojbackward:${property("minecraft_version")}+build.$it")
45+
mappings("dev.lambdaurora:yalmm-mojbackward:$mcversion+build.$it")
4546
}
4647
})
4748
modImplementation("net.fabricmc:fabric-loader:${property("loader_version")}")
48-
modImplementation("org.polyfrost.oneconfig:${property("minecraft_version")}-fabric:1.0.0-alpha.181")
49-
modImplementation("org.polyfrost.oneconfig:commands:1.0.0-alpha.181")
50-
modImplementation("org.polyfrost.oneconfig:config:1.0.0-alpha.181")
51-
modImplementation("org.polyfrost.oneconfig:config-impl:1.0.0-alpha.181")
52-
modImplementation("org.polyfrost.oneconfig:events:1.0.0-alpha.181")
53-
modImplementation("org.polyfrost.oneconfig:internal:1.0.0-alpha.181")
54-
modImplementation("org.polyfrost.oneconfig:ui:1.0.0-alpha.181")
55-
modImplementation("org.polyfrost.oneconfig:utils:1.0.0-alpha.181")
56-
modImplementation("org.polyfrost.oneconfig:hud:1.0.0-alpha.181")
49+
modImplementation("org.polyfrost.oneconfig:$mcversion-fabric:$oneconfigversion")
50+
for (module in arrayOf("config", "config-impl", "internal", "ui")) {
51+
implementation("org.polyfrost.oneconfig:$module:$oneconfigversion")
52+
}
5753
}
5854

5955
bloom {
@@ -101,4 +97,31 @@ tasks.jar {
10197
}
10298

10399
fun <T> optionalProp(property: String, block: (String) -> T?): T? =
104-
findProperty(property)?.toString()?.takeUnless { it.isBlank() }?.let(block)
100+
findProperty(property)?.toString()?.takeUnless { it.isBlank() }?.let(block)
101+
102+
val modrinthId = findProperty("publish.modrinth")?.toString()?.takeIf { it.isNotBlank() }
103+
104+
// make sure modrinth.token is set in your user gradle properties
105+
publishMods {
106+
file = project.tasks.remapJar.get().archiveFile
107+
108+
displayName = modversion.toString()
109+
version = "v$modversion"
110+
changelog = project.rootProject.file("CHANGELOG.md").takeIf { it.exists() }?.readText() ?: "No changelog provided."
111+
type = ALPHA
112+
113+
modLoaders.add("fabric")
114+
115+
dryRun = modrinthId == null
116+
117+
if (modrinthId != null) {
118+
modrinth {
119+
projectId = property("publish.modrinth").toString()
120+
accessToken = findProperty("modrinth.token").toString()
121+
122+
minecraftVersions.add(mcversion)
123+
124+
requires("oneconfig")
125+
}
126+
}
127+
}

gradle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ mod.group=org.polyfrost
55

66
loom_version=1.14-SNAPSHOT
77
loader_version=0.18.4
8-
minecraft_version=[VERSIONED]
8+
oneconfig_version=1.0.0-alpha.182
99
parchment_version=[VERSIONED]
1010
yalmm_version=[VERSIONED]
1111

12+
publish.modrinth=r8Cr8YRg
13+
1214
org.gradle.daemon=true
1315
org.gradle.parallel=true
1416
org.gradle.configureoncommand=true

settings.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ plugins {
2020

2121
stonecutter {
2222
create(rootProject) {
23-
versions("1.21.1", "1.21.4", "1.21.8", "1.21.10")
23+
versions("1.21.1", "1.21.4", "1.21.8", "1.21.10", "1.21.11")
2424

25-
vcsVersion = "1.21.10"
25+
vcsVersion = "1.21.11"
2626
}
2727
}
2828

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
package org.polyfrost.polyweather.mixin.client;
22

3-
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
4-
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
53
//? if >=1.21.4 {
6-
import net.minecraft.client.multiplayer.ClientLevel;
4+
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
75
import net.minecraft.client.renderer.WeatherEffectRenderer;
8-
import org.polyfrost.polyweather.client.ClientWeatherManager;
96
//?} else {
10-
/*import net.minecraft.client.renderer.LevelRenderer;
11-
import net.minecraft.world.level.biome.Biome;
7+
/*import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
8+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
9+
import net.minecraft.client.renderer.LevelRenderer;
10+
import net.minecraft.core.BlockPos;
1211
*///?}
12+
import net.minecraft.world.level.biome.Biome;
13+
import org.polyfrost.polyweather.client.ClientWeatherManager;
1314
import org.polyfrost.polyweather.client.PolyWeatherConfig;
1415
import org.spongepowered.asm.mixin.Mixin;
1516
import org.spongepowered.asm.mixin.injection.At;
@@ -20,16 +21,34 @@
2021
/*@Mixin(LevelRenderer.class)
2122
*///?}
2223
public class Mixin_AllowWeatherEverywhere {
23-
@WrapOperation(method = /*? if >=1.21.4 {*/ "tickRainParticles" /*?} else {*/ /*"renderSnowAndRain" *//*?}*/, at = @At(value = "INVOKE", target = /*? if >=1.21.4 {*/ "Lnet/minecraft/client/multiplayer/ClientLevel;getRainLevel(F)F" /*?} else {*/ /*"Lnet/minecraft/world/level/biome/Biome;hasPrecipitation()Z" *//*?}*/))
24-
private /*? if >=1.21.4 {*/ float /*?} else {*/ /*boolean *//*?}*/ allowRainEverywhere(/*? if >=1.21.4 {*/ ClientLevel instance, float delta /*?} else {*/ /*Biome instance *//*?}*/, Operation</*? if >=1.21.4 {*/ Float /*?} else {*/ /*Boolean *//*?}*/> original) {
24+
//? if >=1.21.4 {
25+
@ModifyReturnValue(method = "getPrecipitationAt", at = @At("RETURN"))
26+
//?} else {
27+
/*@WrapOperation(method = "renderSnowAndRain", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/biome/Biome;getPrecipitationAt(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/biome/Biome$Precipitation;"))
28+
*///?}
29+
private Biome.Precipitation changeWeather(/*? if >=1.21.4 {*/ Biome.Precipitation original /*?} else {*/ /*Biome instance, BlockPos pos, Operation<Biome.Precipitation> original *//*?}*/) {
30+
if (PolyWeatherConfig.isEnabled()) {
31+
if (ClientWeatherManager.isSnowy()) {
32+
return Biome.Precipitation.SNOW;
33+
} else if (ClientWeatherManager.isRainy()) {
34+
return Biome.Precipitation.RAIN;
35+
} else {
36+
return Biome.Precipitation.NONE;
37+
}
38+
}
39+
40+
41+
return original/*? if <1.21.4 {*//*.call(instance, pos) *//*?}*/;
42+
}
43+
44+
//? if <1.21.4 {
45+
/*@WrapOperation(method = "renderSnowAndRain", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/biome/Biome;hasPrecipitation()Z"))
46+
private boolean allowWeatherEverywhere(Biome instance, Operation<Boolean> original) {
2547
if (PolyWeatherConfig.isEnabled()) {
26-
//? if >=1.21.4 {
27-
return ClientWeatherManager.getPrecipitationStrength(delta);
28-
//?} else {
29-
/*return true;
30-
*///?}
48+
return true;
3149
}
3250
33-
return original.call(instance /*? if >=1.21.4 {*/, delta /*?}*/);
51+
return original.call(instance);
3452
}
53+
*///?}
3554
}

src/main/java/org/polyfrost/polyweather/mixin/client/Mixin_CancelGroundParticles.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*///?}
2323
public class Mixin_CancelGroundParticles {
2424
@Inject(method = /*? if >=1.21.4 {*/ "tickRainParticles" /*?} else {*/ /*"tickRain" *//*?}*/, at = @At("HEAD"), cancellable = true)
25-
private void cancelGroundParticles(/*? if >=1.21.4 {*/ ClientLevel arg, Camera arg2, int m, ParticleStatus arg3, /*?}*/ CallbackInfo ci) {
25+
private void cancelGroundParticles(/*? if >=1.21.4 {*/ ClientLevel clientLevel, Camera camera, int m, ParticleStatus particleStatus, /*?}*/ /*? if >=1.21.11 {*/ int j, /*?}*/ CallbackInfo ci) {
2626
if (PolyWeatherConfig.isEnabled() && (!ClientWeatherManager.isRainy() || ClientWeatherManager.isSnowy())) {
2727
ci.cancel();
2828
}
Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,58 @@
11
package org.polyfrost.polyweather.mixin.client;
22

3-
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
3+
//? if >=1.21.11 {
4+
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
5+
import net.minecraft.world.attribute.WeatherAttributes;
6+
//?} else {
7+
/*import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
48
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
59
import net.minecraft.client.multiplayer.ClientLevel;
10+
*///?}
611
import org.polyfrost.polyweather.client.ClientWeatherManager;
712
import org.polyfrost.polyweather.client.PolyWeatherConfig;
813
import org.spongepowered.asm.mixin.Mixin;
914
import org.spongepowered.asm.mixin.injection.At;
1015

11-
@Mixin(ClientLevel.class)
12-
public class Mixin_FixWorldColors {
13-
@WrapOperation(method = "getSkyColor", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel;getRainLevel(F)F"))
14-
private float fixSkyColors(ClientLevel instance, float delta, Operation<Float> original) {
15-
if (PolyWeatherConfig.isEnabled()) {
16-
return ClientWeatherManager.getPrecipitationStrength(delta);
17-
}
18-
19-
return original.call(instance, delta);
16+
//? if >=1.21.11 {
17+
@Mixin(WeatherAttributes.WeatherAccess.class)
18+
//?} else {
19+
/*@Mixin(ClientLevel.class)
20+
*///?}
21+
public /*? if >=1.21.11 {*/ interface /*?} else {*//* class *//*?}*/ Mixin_FixWorldColors {
22+
//? if >=1.21.11 {
23+
@ModifyReturnValue(method = "from", at = @At("RETURN"))
24+
private static WeatherAttributes.WeatherAccess modifyWeather(WeatherAttributes.WeatherAccess original) {
25+
return new WeatherAttributes.WeatherAccess() {
26+
@Override
27+
public float rainLevel() {
28+
if (!PolyWeatherConfig.isEnabled()) return original.rainLevel();
29+
return ClientWeatherManager.getPrecipitationStrength(1.0f);
30+
}
31+
32+
@Override
33+
public float thunderLevel() {
34+
if (!PolyWeatherConfig.isEnabled()) return original.thunderLevel();
35+
return ClientWeatherManager.getStormStrength(1.0f);
36+
}
37+
};
2038
}
21-
22-
@WrapOperation(method = "getSkyColor", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel;getThunderLevel(F)F"))
23-
private float fixSkyColorsThunder(ClientLevel instance, float delta, Operation<Float> original) {
24-
if (PolyWeatherConfig.isEnabled()) {
25-
return ClientWeatherManager.getStormStrength(delta);
26-
}
27-
28-
return original.call(instance, delta);
29-
}
30-
31-
@WrapOperation(method = "getCloudColor", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel;getRainLevel(F)F"))
32-
private float fixCloudColors(ClientLevel instance, float delta, Operation<Float> original) {
39+
//?} else {
40+
/*@WrapOperation(method = {"getSkyColor", "getSkyDarken", "getCloudColor"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel;getRainLevel(F)F"))
41+
private float modifyPrecipitationStrength(ClientLevel instance, float delta, Operation<Float> original) {
3342
if (PolyWeatherConfig.isEnabled()) {
3443
return ClientWeatherManager.getPrecipitationStrength(delta);
3544
}
3645
3746
return original.call(instance, delta);
3847
}
3948
40-
@WrapOperation(method = "getCloudColor", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel;getThunderLevel(F)F"))
41-
private float fixCloudColorsThunder(ClientLevel instance, float delta, Operation<Float> original) {
49+
@WrapOperation(method = {"getSkyColor", "getSkyDarken", "getCloudColor"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel;getThunderLevel(F)F"))
50+
private float modifyThunderStrength(ClientLevel instance, float delta, Operation<Float> original) {
4251
if (PolyWeatherConfig.isEnabled()) {
4352
return ClientWeatherManager.getStormStrength(delta);
4453
}
4554
4655
return original.call(instance, delta);
4756
}
57+
*///?}
4858
}

src/main/java/org/polyfrost/polyweather/mixin/client/Mixin_ForceSnow.java

Lines changed: 0 additions & 46 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package org.polyfrost.polyweather.mixin.client;
2+
3+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
4+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
5+
import net.minecraft.client.multiplayer.ClientLevel;
6+
//? if >=1.21.10 {
7+
import net.minecraft.client.renderer.SkyRenderer;
8+
//?} else
9+
/*import net.minecraft.client.renderer.LevelRenderer;*/
10+
import org.polyfrost.polyweather.client.ClientWeatherManager;
11+
import org.polyfrost.polyweather.client.PolyWeatherConfig;
12+
import org.spongepowered.asm.mixin.Mixin;
13+
import org.spongepowered.asm.mixin.injection.At;
14+
15+
//? if >=1.21.10 {
16+
@Mixin(SkyRenderer.class)
17+
//?} else
18+
/*@Mixin(LevelRenderer.class)*/
19+
public class Mixin_HideCelestialBodies {
20+
@WrapOperation(method = /*? if >=1.21.10 {*/ "extractRenderState" /*?} else if >=1.21.4 {*/ /*"method_62215" *//*?} else {*//* "renderSky" *//*?}*/, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel;getRainLevel(F)F"))
21+
private float modifyRainStrength(ClientLevel instance, float delta, Operation<Float> original) {
22+
if (PolyWeatherConfig.isEnabled()) {
23+
return ClientWeatherManager.getPrecipitationStrength(delta);
24+
}
25+
26+
return original.call(instance, delta);
27+
}
28+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package org.polyfrost.polyweather.mixin.client;
2+
3+
//? if >=1.21.8 <=1.21.10 {
4+
/*import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
5+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
6+
import net.minecraft.client.multiplayer.ClientLevel;
7+
import net.minecraft.client.renderer.fog.environment.AirBasedFogEnvironment;
8+
import org.polyfrost.polyweather.client.ClientWeatherManager;
9+
import org.polyfrost.polyweather.client.PolyWeatherConfig;
10+
import org.spongepowered.asm.mixin.Mixin;
11+
import org.spongepowered.asm.mixin.injection.At;
12+
13+
@Mixin(AirBasedFogEnvironment.class)
14+
public class Mixin_ModifyFogColor {
15+
@WrapOperation(method = "getBaseColor", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel;getRainLevel(F)F"))
16+
private static float modifyPrecipitationStrength(ClientLevel instance, float delta, Operation<Float> original) {
17+
if (PolyWeatherConfig.isEnabled()) {
18+
return ClientWeatherManager.getPrecipitationStrength(delta);
19+
}
20+
21+
return original.call(instance, delta);
22+
}
23+
}
24+
*///?}

0 commit comments

Comments
 (0)