13 Commits
1.0.1 ... 1.2.1

Author SHA1 Message Date
ac040b84cd fix: update to loom 1.7 to fix forge crashing on launch (#12)
This commit also releases Weather Changer v1.2.1
2024-12-16 13:28:39 +13:00
37645401e3 docs: add version 1.2.0 to README 2024-10-21 19:28:44 +13:00
8c344ec47d fix: client allowing trident use while server weather not thundering
This change fixes some issues where when using weather changer and setting your client weather to thunder trident usage would be allowed even when the server weather was not thundering, also fixes an issue where on single player mobs would spawn when client weather was set to rain or thunder

This commit also releases version 1.2.0
2024-10-21 19:05:51 +13:00
Amirhan-Taipovjan-Greatest-I
2dc3d64ca1 Actualized Tatar and Russian Translations! (#9)
* Actualized Vanilla-ish Tatar Translation!

* Updated ≈Vanilla-ish Russian Translation!
2024-08-18 14:00:50 +12:00
Thierry Schmid
c5f5a278e3 Timer functionality as suggested a month ago (#7)
* first implementation of timer

* first implementation of timer

* String message turned to a translatable text
2024-08-10 22:34:26 +12:00
4ee3169caa fix: java 21 on release ci 2024-08-09 14:50:40 +12:00
0f7343078b Merge branch 'refs/heads/develop'
# Conflicts:
#	.github/workflows/release.yml
2024-08-09 14:48:43 +12:00
6f0d8d11f6 ci: fix release workflow 2024-08-09 14:47:00 +12:00
e1566f6c5b 1.21 Fabric (#8)
Prep for release of version 1.1.0 (MC 1.21 for Fabric only)
2024-08-09 14:24:09 +12:00
338aeeca56 docs: remove outdated link 2024-08-09 14:18:07 +12:00
4e53b55b1e Java 21 2024-08-09 14:16:32 +12:00
73fbd40685 1.21 Fabric 2024-08-09 14:13:55 +12:00
9390eb3881 [skip ci] docs: confirm 1.20.6 support add 1.0.1 version to README 2024-05-01 15:05:31 +12:00
20 changed files with 188 additions and 90 deletions

View File

@@ -2,8 +2,7 @@ name: Build
on:
push:
branches-ignore:
- main
pull_request:
jobs:
build:
@@ -11,11 +10,11 @@ jobs:
env:
CI_DEV_BUILD: true
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
- name: Setup build number
run: echo "BUILD_NUMBER=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
@@ -26,7 +25,7 @@ jobs:
with:
arguments: build
- name: Upload Build Results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: weather-changer-build
path: |

View File

@@ -2,18 +2,19 @@ name: Release
on:
push:
branches:
- main
tags:
- '[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
- name: Make gradlew executable
run: chmod +x ./gradlew
@@ -22,7 +23,7 @@ jobs:
with:
arguments: build
- name: Upload Build Results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: build
path: |
@@ -37,8 +38,8 @@ jobs:
GH_TOKEN: ${{ github.token }}
needs: [build]
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Create Release
run: |
mkdir dist

View File

View File

@@ -1,3 +1,5 @@
<!-- modrinth_exclude.start -->
<!--suppress HtmlDeprecatedAttribute -->
<p align="center" style="display: block;margin-left: auto;margin-right: auto;margin-bottom: 0">
<img src="assets/logo-242x242.png" alt="Weather Changer Logo"/>
@@ -13,6 +15,8 @@
<img src="assets/banner.png" alt="Weather Changer Banner"/>
</p>
<!-- modrinth_exclude.end -->
## Overview
Changes the weather on client side (only visible to you) to clear, rain, or thunder, this mod does not affect the server or send any packets to the server.
@@ -43,25 +47,30 @@ You can download the mod from any of the platforms below.
**Modrinth (_recommended_)**: https://modrinth.com/mod/weather-changer <br>
**Curseforge**: https://www.curseforge.com/minecraft/mc-mods/weather-changer <br>
**GitHub Releases:** https://github.com/Lucaslah/WeatherChanger/releases <br>
**Release Server**: https://release.cssudii.xyz/projects/weatherchanger
<!-- modrinth_exclude.end -->
## Release History
| Branch | Version | MC Version | Mod loaders | Git Tag | CI | Supported |
|--------|---------|---------------|---------------|------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------|
| main | v1.0.0 | 1.20.1-1.20.4 | fabric, forge | [1.0.0](https://github.com/Lucaslah/WeatherChanger/releases/tag/1.0.0) | [![Build](https://github.com/Lucaslah/WeatherChanger/actions/workflows/release.yml/badge.svg?branch=main)](https://github.com/Lucaslah/WeatherChanger/actions/workflows/release.yml) | Yes |
| Version | MC Version | Mod loaders | Git Tag | Supported |
|---------|---------------|---------------|------------------------------------------------------------------------|-----------|
| v1.2.1 | 1.21 | fabric,forge | [1.2.0](https://github.com/Lucaslah/WeatherChanger/releases/tag/1.2.0) | Yes |
| v1.2.0 | 1.21 | fabric | [1.2.0](https://github.com/Lucaslah/WeatherChanger/releases/tag/1.2.0) | No |
| v1.1.0 | 1.21 | fabric | [1.1.0](https://github.com/Lucaslah/WeatherChanger/releases/tag/1.1.0) | No |
| v1.0.1 | 1.20.1-1.20.6 | fabric, forge | [1.0.1](https://github.com/Lucaslah/WeatherChanger/releases/tag/1.0.1) | Yes |
| v1.0.0 | 1.20.1-1.20.4 | fabric, forge | [1.0.0](https://github.com/Lucaslah/WeatherChanger/releases/tag/1.0.0) | No |
### Pre-release (v0) versions
| Branch | Version | MC Version | Mod loaders | Git Tag | CI | Supported |
|--------|---------|---------------|-------------|------------------------------------------------------------------------|-----|-----------|
| N/A | v0.3.0 | 1.20.1-1.20.4 | fabric | [0.3.0](https://github.com/Lucaslah/WeatherChanger/releases/tag/0.3.0) | N/A | No |
| N/A | v0.2.0 | 1.19.3 | fabric | [0.2.0](https://github.com/Lucaslah/WeatherChanger/releases/tag/0.2.0) | N/A | No |
| N/A | v0.1.0 | 1.19.1-1.19.2 | fabric | [0.1.0](https://github.com/Lucaslah/WeatherChanger/releases/tag/0.1.0) | N/A | No |
| Version | MC Version | Mod loaders | Git Tag | Supported |
|---------|---------------|-------------|------------------------------------------------------------------------|-----------|
| v0.3.0 | 1.20.1-1.20.4 | fabric | [0.3.0](https://github.com/Lucaslah/WeatherChanger/releases/tag/0.3.0) | No |
| v0.2.0 | 1.19.3 | fabric | [0.2.0](https://github.com/Lucaslah/WeatherChanger/releases/tag/0.2.0) | No |
| v0.1.0 | 1.19.1-1.19.2 | fabric | [0.1.0](https://github.com/Lucaslah/WeatherChanger/releases/tag/0.1.0) | No |
## Minecraft Versions
| Version | Status |
|---------|---------------------------------|
| 1.21 | Supported |
| 1.20.6 | Supported |
| 1.20.5 | Supported |
| 1.20.4 | Supported |
| 1.20.3 | Supported |

View File

@@ -1,14 +1,9 @@
import io.github.themrmilchmann.gradle.publish.curseforge.ChangelogFormat
import io.github.themrmilchmann.gradle.publish.curseforge.GameVersion
import io.github.themrmilchmann.gradle.publish.curseforge.ReleaseType
import net.fabricmc.loom.task.RemapJarTask
import net.fabricmc.loom.task.RemapSourcesJarTask
plugins {
id("architectury-plugin") version "3.4.+"
id ("dev.architectury.loom") version "1.5.+" apply false
id("com.modrinth.minotaur") version "2.+"
id("io.github.themrmilchmann.curseforge-publish") version "0.6.1"
id ("dev.architectury.loom") version "1.7.+" apply false
}
architectury {
@@ -55,48 +50,3 @@ allprojects {
group = properties["maven_group"].toString()
}
modrinth {
token.set(System.getenv("MODRINTH_TOKEN"))
projectId.set("nhSHTGyl")
versionNumber.set(properties["mod_version"].toString())
versionType.set(properties["release_channel"].toString())
uploadFile.set("build/libs/weather-changer-1.0.0.jar")
gameVersions.addAll("1.20", "1.20.1", "1.20.2", "1.20.3", "1.20.4")
loaders.add("fabric")
loaders.add("forge")
dependencies {
required.project("fabric-api")
}
syncBodyFrom = rootProject.file("README.md").readText()
}
curseforge {
apiToken = System.getenv("CURSEFORGE_TOKEN")
publications {
register("curseForge") {
projectId = "682513"
gameVersions.add(GameVersion("minecraft-1-20", "1.20"))
gameVersions.add(GameVersion("minecraft-1-20", "1.20.1"))
gameVersions.add(GameVersion("minecraft-1-20", "1.20.2"))
gameVersions.add(GameVersion("minecraft-1-20", "1.20.3"))
gameVersions.add(GameVersion("minecraft-1-20", "1.20.4"))
artifacts.register("main") {
displayName = "Weather Changer"
// TODO: read from file
releaseType = ReleaseType.BETA
changelog {
// TODO: get from git diff
format = ChangelogFormat.MARKDOWN
from(file("CHANGELOG.md"))
}
}
}
}
}

View File

@@ -11,6 +11,7 @@ import me.lucaslah.weatherchanger.keys.ToggleClearKey;
import me.lucaslah.weatherchanger.keys.ToggleOffKey;
import me.lucaslah.weatherchanger.keys.ToggleRainKey;
import me.lucaslah.weatherchanger.keys.ToggleThunderKey;
import me.lucaslah.weatherchanger.timerlogic.Timer;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;
@@ -27,6 +28,8 @@ public class WeatherChanger {
private static WeatherChangerPlatform platform;
private static KeybindingManager keybindingManager;
private static CommandManager commandManager;
private static Timer weatherTimer;
private static boolean timerEnabled = false; // Default to false
public static void init(WeatherChangerPlatform platform) {
WeatherChanger.platform = platform;
@@ -57,6 +60,8 @@ public class WeatherChanger {
.add(new ToggleThunderKey());
commandManager.add(new WeatherChangerCommand());
weatherTimer = new Timer();
}
private static void loadConfig() {
@@ -151,4 +156,12 @@ public class WeatherChanger {
public static void sendClientMessage(Text message) {
MinecraftClient.getInstance().inGameHud.getChatHud().addMessage(message);
}
public static void toggleTimer() {
timerEnabled = !timerEnabled;
}
public static boolean isTimerEnabled() {
return timerEnabled;
}
}

View File

@@ -48,13 +48,22 @@ public class WeatherChangerCommand extends Command {
})
);
command.then(LiteralArgumentBuilder.<T>literal("toggleTimer")
.executes(context -> {
WeatherChanger.toggleTimer();
Text message = WeatherChanger.isTimerEnabled() ? Text.translatable("commands.weatherchanger.timer.on") : Text.translatable("commands.weatherchanger.timer.off");
sendClientMessage(message);
return 1;
})
);
LiteralCommandNode<T> node = dispatcher.register(command);
dispatcher.register(LiteralArgumentBuilder.<T>literal("cweather").redirect(node));
}
@Override
public Identifier getId() {
return new Identifier("weatherchanger", "corecommand");
return Identifier.of("weatherchanger", "corecommand");
}
@Override

View File

@@ -25,7 +25,7 @@ public class ToggleClearKey extends Key {
@Override
public Identifier getId() {
return new Identifier("weatherchanger", "toggleclearkey");
return Identifier.of("weatherchanger", "toggleclearkey");
}
@Override

View File

@@ -25,7 +25,7 @@ public class ToggleOffKey extends Key {
@Override
public Identifier getId() {
return new Identifier("weatherchanger", "toggleoffkey");
return Identifier.of("weatherchanger", "toggleoffkey");
}
@Override

View File

@@ -25,7 +25,7 @@ public class ToggleRainKey extends Key {
@Override
public Identifier getId() {
return new Identifier("weatherchanger", "togglerainkey");
return Identifier.of("weatherchanger", "togglerainkey");
}
@Override

View File

@@ -25,7 +25,7 @@ public class ToggleThunderKey extends Key {
@Override
public Identifier getId() {
return new Identifier("weatherchanger", "togglethunderkey");
return Identifier.of("weatherchanger", "togglethunderkey");
}
@Override

View File

@@ -2,14 +2,21 @@ package me.lucaslah.weatherchanger.mixin;
import me.lucaslah.weatherchanger.WeatherChanger;
import me.lucaslah.weatherchanger.config.WcMode;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Environment(EnvType.CLIENT)
@Mixin(World.class)
public class WorldMixin {
@Shadow
@@ -21,6 +28,23 @@ public class WorldMixin {
@Shadow
protected float thunderGradient;
@Shadow @Final private RegistryEntry<DimensionType> dimensionEntry;
@Unique
private float weatherChanger$getRainGradientOg(float delta) {
return MathHelper.lerp(delta, this.rainGradientPrev, this.rainGradient);
}
@Unique
private float weatherChanger$getThunderGradientOg(float delta) {
return MathHelper.lerp(delta, this.thunderGradientPrev, this.thunderGradient) * this.weatherChanger$getRainGradientOg(delta);
}
@Unique
public DimensionType weatherChanger$getDimension() {
return this.dimensionEntry.value();
}
@Inject(method = "getRainGradient", at = @At("HEAD"), cancellable = true)
public void getRainGradient(float delta, CallbackInfoReturnable<Float> callback) {
WcMode mode = WeatherChanger.getMode();
@@ -50,4 +74,22 @@ public class WorldMixin {
callback.cancel();
}
@Inject(method = "isRaining", at = @At("HEAD"), cancellable = true)
public void isRaining(CallbackInfoReturnable<Boolean> callback) {
callback.setReturnValue((double)this.weatherChanger$getRainGradientOg(1.0F) > 0.2);
callback.cancel();
}
@Inject(method = "isThundering", at = @At("HEAD"), cancellable = true)
public void isThundering(CallbackInfoReturnable<Boolean> callback) {
if (this.weatherChanger$getDimension().hasSkyLight() && !(this.weatherChanger$getDimension().hasCeiling())) {
callback.setReturnValue((double)this.weatherChanger$getThunderGradientOg(1.0F) > 0.9);
} else {
callback.setReturnValue(false);
}
callback.cancel();
}
}

View File

@@ -0,0 +1,66 @@
package me.lucaslah.weatherchanger.timerlogic;
import me.lucaslah.weatherchanger.WeatherChanger;
import me.lucaslah.weatherchanger.config.WcMode;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.Random;
public class Timer {
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
private final Random random = new Random();
public Timer() {
scheduleWeatherChange();
scheduleWeatherIntensityAdjustment();
}
private void scheduleWeatherChange() {
int initialDelay = 0; // Start immediately
int delay = 20 + random.nextInt(11); // 20-30 minutes
scheduler.scheduleWithFixedDelay(this::decideWeather, initialDelay, delay, TimeUnit.MINUTES);
}
private void decideWeather() {
if (!WeatherChanger.isTimerEnabled()) return;
if (random.nextDouble() < 0.75) { // 75% chance to change the weather
if (random.nextDouble() < 0.66) { // 66% chance for rain
WeatherChanger.setMode(WcMode.RAIN);
} else { // 33% chance for thunderstorm
WeatherChanger.setMode(WcMode.THUNDER);
}
}
}
private void scheduleWeatherIntensityAdjustment() {
int initialDelay = 1; // Start after 1 minute
int delay = 1 + random.nextInt(2); // 1-2 minutes
scheduler.scheduleWithFixedDelay(this::adjustWeatherIntensity, initialDelay, delay, TimeUnit.MINUTES);
}
private void adjustWeatherIntensity() {
if (!WeatherChanger.isTimerEnabled()) return;
WcMode currentMode = WeatherChanger.getMode();
double chance = random.nextDouble();
if (currentMode == WcMode.RAIN) {
if (chance < 0.05) { // 5% chance to worsen from rain to thunderstorm
WeatherChanger.setMode(WcMode.THUNDER);
} else if (chance < 0.20) { // 15% chance to clear up from rain
WeatherChanger.setMode(WcMode.CLEAR);
}
} else if (currentMode == WcMode.THUNDER) {
if (chance < 0.05) { // 5% chance to worsen, but already at worst so no change
// No change
} else if (chance < 0.20) { // 15% chance to improve from thunderstorm to rain
WeatherChanger.setMode(WcMode.RAIN);
}
} else if (currentMode == WcMode.CLEAR) {
// No change, clear weather cannot improve or worsen in this context
}
}
}

View File

@@ -3,6 +3,8 @@
"commands.weatherchanger.set.clear": "Set client weather to: Clear",
"commands.weatherchanger.set.rain": "Set client weather to: Rain",
"commands.weatherchanger.set.thunder": "Set client weather to: Thunder",
"commands.weatherchanger.timer.on": "Timer enabled",
"commands.weatherchanger.timer.off": "Timer disabled",
"keys.weatherchanger.off.name": "Toggle Weather Off",
"keys.weatherchanger.clear.name": "Toggle Weather Clear",
"keys.weatherchanger.rain.name": "Toggle Weather Rain",

View File

@@ -4,6 +4,8 @@
"commands.weatherchanger.set.clear": "Установлена клиентская погода: Ясная",
"commands.weatherchanger.set.rain": "Установлена клиентская погода: Дождливая",
"commands.weatherchanger.set.thunder": "Установлена клиентская погода: Гроза и дождь",
"commands.weatherchanger.timer.on": "Таймер включен",
"commands.weatherchanger.timer.off": "Таймер выключен",
"keys.weatherchanger.off.name": "Выключить клиентскую погоду",
"keys.weatherchanger.clear.name": "Переключить ясную погоду",
"keys.weatherchanger.rain.name": "Переключить дождливую погоду",

View File

@@ -5,6 +5,8 @@
"commands.weatherchanger.set.clear": "Клиентлы һава торышы урнаштырылды: Аяз",
"commands.weatherchanger.set.rain": "Клиентлы һава торышы урнаштырылды: Яңгырлы",
"commands.weatherchanger.set.thunder": "Клиентлы һава торышы урнаштырылды: Яшенле һәм яңгырлы",
"commands.weatherchanger.timer.on": "Таймер кушык",
"commands.weatherchanger.timer.off": "Таймер сүнек",
"keys.weatherchanger.off.name": "Клиентлы һава торышын сүндерү",
"keys.weatherchanger.clear.name": "Аяз һава торышын күчерү",
"keys.weatherchanger.rain.name": "Яңгырлы һава торышын күчерү",

View File

@@ -2,7 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "me.lucaslah.weatherchanger.mixin",
"compatibilityLevel": "JAVA_17",
"compatibilityLevel": "JAVA_21",
"mixins": [
],
"client": [

View File

@@ -1,27 +1,30 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx2G
# Kotlin
kotlin.code.style=official
# Minecraft Properties
minecraft_version=1.20.1
minecraft_base=1.20.0
yarn_mappings=1.20.1+build.8
minecraft_version=1.21
minecraft_base=1.21
yarn_mappings=1.21+build.7
# Architectury Properties
enabled_platforms=fabric,forge
# Mod Properties
mod_version = 1.0.1
mod_version = 1.2.1
mod_id = weatherchanger
maven_group = me.lucaslah.weatherchanger
archives_base_name = weather-changer
# Release Properties
# options: none,alpha,beta,release
release_channel=none
# options: alpha,beta,release
release_channel=release
# Fabric
fabric.loader_version=0.14.21
fabric.version=0.84.0+1.20.1
fabric.loader_version=0.15.11
fabric.version=0.100.1+1.21
# Forge
forge.version=1.20.1-47.0.3
forge.version=1.21-51.0.21

Binary file not shown.

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME