43 Commits

Author SHA1 Message Date
cdf5cd5d95 Version 1.3.0-beta1 (Fabric) (#17)
* [1.3.0-beta1] Update to 1.21.11

* Fix deploy workflow
2025-12-10 18:21:53 +13:00
80d34ab146 Update README (#16)
* Update README

* Remove new release

* 1.21.0 => 1.21

* Improve wording
2025-12-10 11:13:01 +13:00
0e4c5e1036 Fix issue with refmap naming (#14)
* Fix issue with refmap naming

* Update README
2025-06-20 14:42:20 +12:00
99f504b9ca docs: fix release tag link for v1.2.1 2024-12-16 13:40:40 +13:00
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
67524f1cb8 Merge pull request #5 from Lucaslah/develop
feat: make text translatable + bump to version 1.0.1
2024-04-30 23:06:47 +12:00
184ce53df8 Merge pull request #6 from Amirhan-Taipovjan-Greatest-I/patch-1
Vanilla-ish Tatar Translation and ≈Vanilla-ish Russian Translation.
2024-04-30 23:01:36 +12:00
Amirhan-Taipovjan-Greatest-I
4dbfe76b45 Updated ModMenu Metadata Translation. 2024-04-30 13:55:55 +03:00
Amirhan-Taipovjan-Greatest-I
145c638746 Russian Translation.
It is not quite Vanilla-ish, but I tried to do My best.
2024-04-30 13:53:04 +03:00
Amirhan-Taipovjan-Greatest-I
22372cdd63 Vanilla-ish Tatar Translation. 2024-04-30 13:49:26 +03:00
604d98ac13 fix: update architectury + add base archive name to build
- [bug] add base archive name to build artifacts
- [deps] update architectury loom from 1.4-SNAPSHOT -> 1.5
- [deps] update architectury plugin to non snapshot build
- [bug] fixes an unchecked cast warning during the build
2024-04-30 12:01:12 +12:00
4c046a3828 fix: make keys press text translatable 2024-04-30 11:00:27 +12:00
274c6bb035 Merge branch 'main' into develop 2024-04-29 19:14:11 +12:00
ff08c6ee77 feat: make text translatable + bump to version 1.0.1 2024-04-29 19:10:49 +12:00
cc5d9d2d51 [skip ci] auto deploy website on push 2024-04-04 21:37:06 +13:00
7aedf2fd4a [skip ci] add website deployment 2024-04-04 21:19:15 +13:00
48a4ae23ff ci: fix release.yml 2024-01-19 13:05:58 +13:00
7453eedb42 Merge pull request #3 from Lucaslah/next
Weather Changer v1.0.0 [2024 release C1]
2024-01-19 12:45:17 +13:00
aa35318a9b prep for release (v1.0.0) 2024-01-19 12:36:21 +13:00
aa744b1362 Added forge support + update architectury loom 2024-01-19 12:17:31 +13:00
7eab9daf0b Enable gradle scan on CI
Signed-off-by: Lucas Petrino <nsx1lucas@gmail.com>
2024-01-16 15:26:55 +13:00
892afec17c Fix gradle build
- Removed broken code
- Update README.md
- Update .gitignore

Signed-off-by: Lucas Petrino <nsx1lucas@gmail.com>
2024-01-16 15:07:06 +13:00
b210d0540e Update build scripts
- add publish to modrinth script
- add publish to curseforge script
- update build and release ci
- fix spelling in README.md

Signed-off-by: Lucas Petrino <nsx1lucas@gmail.com>
2024-01-16 14:52:17 +13:00
5ab33b1e63 First progress on forge support
- add forge module
- github actions build and release
- aim for all-in-one jar supporting both fabric and forge

**NOTICE**
Forge support is not currently working.

Signed-off-by: Lucas Petrino <nsx1lucas@gmail.com>
2024-01-15 23:21:57 +13:00
4eaf638e42 Start on NEXT (version 1.0) branch
- update gradle wrapper version (8.4 to 8.5)
- update logo and add banner
- change to gradle kotlin DSL (from groovy)
- update README.md
- update project layout for planned forge support
- move common logic to common module
- change environment to 'client' to prevent servers from loading the mod (#2)
- cleanup unneeded files
- update LICENSE.md to use Markdown format for easier reading
- update version number to prepare for version 1.0

Signed-off-by: Lucas Petrino <nsx1lucas@gmail.com>
2024-01-14 19:20:34 +13:00
993df4b93d docs: fix spacing in links 2023-06-26 12:41:24 -04:00
fec1ffa5de docs: add spacing to links 2023-06-26 12:41:05 -04:00
ab8bf77401 docs: add modrinth link to readme 2023-06-26 12:40:46 -04:00
7fe6efbaa4 Merge pull request #1 from SimplyRin/1.20.1
Update to 1.20.1
2023-06-26 12:34:40 -04:00
SimplyRin
d502932845 update to 1.20.1
Even 1.20.0 probably works
2023-06-25 19:02:33 +09:00
32413cab21 update to 1.19.3 2022-12-13 19:00:47 -05:00
61 changed files with 1554 additions and 764 deletions

View File

@@ -1,25 +0,0 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/java/.devcontainer/base.Dockerfile
# [Choice] Java version (use -bullseye variants on local arm64/Apple Silicon): 11, 17, 11-bullseye, 17-bullseye, 11-buster, 17-buster
ARG VARIANT="17-bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/java:0-${VARIANT}
# [Option] Install Maven
ARG INSTALL_MAVEN="false"
ARG MAVEN_VERSION=""
# [Option] Install Gradle
ARG INSTALL_GRADLE="false"
ARG GRADLE_VERSION=""
RUN if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \
&& if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
ARG NODE_VERSION="none"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

View File

@@ -1,35 +1,24 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/java
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/java
{
"name": "Java",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update the VARIANT arg to pick a Java version: 11, 17
// Append -bullseye or -buster to pin to an OS version.
// Use the -bullseye variants on local arm64/Apple Silicon.
"VARIANT": "17-bullseye",
// Options
"INSTALL_MAVEN": "false",
"INSTALL_GRADLE": "true",
"NODE_VERSION": "none"
}
},
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/java:1-17-bookworm",
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"vscjava.vscode-java-pack"
]
"features": {
"ghcr.io/devcontainers/features/java:1": {
"version": "none",
"installMaven": "false",
"installGradle": "true"
},
"ghcr.io/devcontainers/features/github-cli:1": {
"installDirectlyFromGitHubRelease": true,
"version": "latest"
},
"ghcr.io/itsmechlark/features/act:1": {
"version": "latest"
}
},
}
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
@@ -37,12 +26,9 @@
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "java -version",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"features": {
"git": "os-provided",
"github-cli": "latest",
"sshd": "latest",
"fish": "latest"
}
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}

9
.gitattributes vendored Normal file
View File

@@ -0,0 +1,9 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf
# These are Windows script files and should use crlf
*.bat text eol=crlf

33
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,33 @@
name: Build
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
env:
CI_DEV_BUILD: true
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Setup build number
run: echo "BUILD_NUMBER=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Build with Gradle
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25
with:
arguments: build
- name: Upload Build Results
uses: actions/upload-artifact@v4
with:
name: weather-changer-build
path: |
fabric/build/libs/*.jar
forge/build/libs/*.jar

66
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,66 @@
name: Release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Build with Gradle
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25
with:
arguments: build
- name: Upload Build Results
uses: actions/upload-artifact@v4
with:
name: build
path: |
fabric/build/libs/*.jar
forge/build/libs/*.jar
release:
runs-on: ubuntu-latest
permissions:
contents: write
env:
GH_TOKEN: ${{ github.token }}
needs: [build]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Create Release
run: |
mkdir dist
shopt -s nullglob
mv build/{fabric,forge}/build/libs/*.jar dist/
pushd dist
shasum -a 256 * > checksums.txt
popd
version=$(grep mod_version gradle.properties | cut -d'=' -f2 | awk '{gsub(/^ +| + $/,""); print}')
channel=$(grep release_channel gradle.properties | cut -d'=' -f2 | awk '{gsub(/^ +| + $/,""); print}')
release_args=(
"$version"
--title "Weather Changer ${version}"
--generate-notes
)
if [[ "$channel" == "alpha" || "$channel" == "beta" ]]; then
release_args+=( --prerelease )
fi
gh release create "${release_args[@]}" ./dist/*

41
.github/workflows/website.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: Deploy Website
on:
workflow_dispatch:
push:
branches:
- gh-pages
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy-website:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Install dependencies
run: yarn install
- name: Build
run: yarn build
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

1
.gitignore vendored
View File

@@ -31,3 +31,4 @@ bin/
# fabric
run/
.architectury-transformer/

165
LICENSE
View File

@@ -1,165 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

157
LICENSE.md Normal file
View File

@@ -0,0 +1,157 @@
# GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
<https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates the
terms and conditions of version 3 of the GNU General Public License,
supplemented by the additional permissions listed below.
## 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the
GNU General Public License.
"The Library" refers to a covered work governed by this License, other
than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
## 1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
## 2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
- a) under this License, provided that you make a good faith effort
to ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
- b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
## 3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from a
header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
- a) Give prominent notice with each copy of the object code that
the Library is used in it and that the Library and its use are
covered by this License.
- b) Accompany the object code with a copy of the GNU GPL and this
license document.
## 4. Combined Works.
You may convey a Combined Work under terms of your choice that, taken
together, effectively do not restrict modification of the portions of
the Library contained in the Combined Work and reverse engineering for
debugging such modifications, if you also do each of the following:
- a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
- b) Accompany the Combined Work with a copy of the GNU GPL and this
license document.
- c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
- d) Do one of the following:
- 0) Convey the Minimal Corresponding Source under the terms of
this License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
- 1) Use a suitable shared library mechanism for linking with
the Library. A suitable mechanism is one that (a) uses at run
time a copy of the Library already present on the user's
computer system, and (b) will operate properly with a modified
version of the Library that is interface-compatible with the
Linked Version.
- e) Provide Installation Information, but only if you would
otherwise be required to provide such information under section 6
of the GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the Application
with a modified version of the Linked Version. (If you use option
4d0, the Installation Information must accompany the Minimal
Corresponding Source and Corresponding Application Code. If you
use option 4d1, you must provide the Installation Information in
the manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.)
## 5. Combined Libraries.
You may place library facilities that are a work based on the Library
side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
- a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities, conveyed under the terms of this License.
- b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
## 6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
as you received it specifies that a certain numbered version of the
GNU Lesser General Public License "or any later version" applies to
it, you have the option of following the terms and conditions either
of that published version or of any later version published by the
Free Software Foundation. If the Library as you received it does not
specify a version number of the GNU Lesser General Public License, you
may choose any version of the GNU Lesser General Public License ever
published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View File

@@ -1,9 +1,65 @@
# Weather Changer
Changes the weather on client side
<!-- modrinth_exclude.start -->
Supports fabric 1.19+, forge support is coming soon!\
The fabric api is required.
<!--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"/>
</p>
## Links
Curseforge: https://www.curseforge.com/minecraft/mc-mods/weather-changer <br>
Modrinth: TBA
<h1 align="center" style="margin-top: 0;margin-bottom: 0">Weather Changer</h1>
<p align="center" style="margin-top: 0;">Client side weather change for Minecraft</p>
<p align="center"><a href="https://www.curseforge.com/minecraft/mc-mods/weather-changer"><img src="https://cf.way2muchnoise.eu/full_682513_downloads.svg" alt="curseforge-downloads"></a>
<a href="https://modrinth.com/mod/weather-changer"><img src="https://img.shields.io/modrinth/dt/nhSHTGyl?logo=Modrinth" alt="modrinth-downloads"></a></p>
<p align="center" style="display: block;margin: 0 auto;">
<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.
Supports forge and fabric, requires the [Fabric API](https://modrinth.com/mod/P7dR8mSH) when using fabric
### In-Game Command Usage
`/clientweather <off | clear | rain | thunder>`
The command alias `/cweather` may also be used as a shortcut.
### Keybindings
If you would like to set the keybindings, you can do so in the minecraft keybinding settings.
| Description | Default |
|----------------------------------------------------------------------------------|---------|
| Disable the client weather (weather will display the server weather like normal) | Unbound |
| Set the client weather mod to clear | Unbound |
| Set the client weather mod to rain | Unbound |
| Set the client weather mod to thunder | Unbound |
<!-- modrinth_exclude.start -->
## Download
You can download the mod from any of the platforms below.
**Curseforge**: https://www.curseforge.com/minecraft/mc-mods/weather-changer <br>
**Modrinth**: https://modrinth.com/mod/weather-changer <br>
**GitHub Releases:** https://github.com/Lucaslah/WeatherChanger/releases <br>
<!-- modrinth_exclude.end -->
## Supported Versions
Supported versions may receive bug fixes,
older Minecraft versions may work with older
Weather Changer versions, but are not supported.
See the [GitHub releases](https://github.com/Lucaslah/WeatherChanger/releases) page for full release history.
| Weather Changer Version | Minecraft Version | Mod loaders | Latest Release |
|-------------------------|-------------------|---------------|------------------------------------------------------------------------------------|
| v1.3.x | 1.21.11 | Fabric, Forge | [1.3.0-beta1](https://github.com/Lucaslah/WeatherChanger/releases/tag/1.3.0-beta1) |
| v1.2.x | 1.21-1.21.10 | Fabric, Forge | [1.2.2](https://github.com/Lucaslah/WeatherChanger/releases/tag/1.2.2) |
------------------------------------------
*Licensed under the [GNU Lesser General Public License v3.0](https://www.gnu.org/licenses/lgpl-3.0.en.html) license.*

BIN
assets/banner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
assets/logo-242x242.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

BIN
assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1013 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 380 KiB

View File

@@ -1,92 +0,0 @@
plugins {
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'maven-publish'
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
}
configurations {
includeModImplementation
includeImplementation
include.extendsFrom includeImplementation
include.extendsFrom includeModImplementation
implementation.extendsFrom includeImplementation
modImplementation.extendsFrom includeModImplementation
}
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
// Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
//includeModImplementation fabricApi.module("fabric-api-base", project.fabric_version)
//includeModImplementation fabricApi.module("fabric-command-api-v2", project.fabric_version)
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
}
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}

51
build.gradle.kts Normal file
View File

@@ -0,0 +1,51 @@
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.13.+" apply false
}
architectury {
minecraft = properties["minecraft_version"].toString()
}
subprojects {
apply(plugin = "java")
apply(plugin = "architectury-plugin")
apply(plugin = "dev.architectury.loom")
dependencies {
"minecraft"("com.mojang:minecraft:${properties["minecraft_version"]}")
"mappings"("net.fabricmc:yarn:${rootProject.properties["yarn_mappings"]}:v2")
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(21)
}
tasks.withType<Jar> {
archiveBaseName.set(properties["archives_base_name"].toString() + "-${project.name}")
}
tasks.withType<RemapJarTask> {
archiveBaseName.set(properties["archives_base_name"].toString() + "-${project.name}")
}
tasks.withType<RemapSourcesJarTask> {
archiveBaseName.set(properties["archives_base_name"].toString() + "-${project.name}")
}
}
allprojects {
apply(plugin = "maven-publish")
version = if (System.getenv("CI_DEV_BUILD")?.toBoolean() == true) {
System.getenv("BUILD_NUMBER") ?: properties["mod_version"].toString()
} else {
properties["mod_version"].toString()
}
group = properties["maven_group"].toString()
}

17
common/build.gradle.kts Normal file
View File

@@ -0,0 +1,17 @@
architectury {
injectInjectables = false
common(rootProject.property("enabled_platforms").toString().split(","))
}
loom {
accessWidenerPath = file("src/main/resources/weatherchanger.accesswidener")
}
repositories {
mavenCentral()
}
dependencies {
implementation("com.google.code.gson:gson:2.10.1")
modImplementation("net.fabricmc:fabric-loader:${rootProject.property("fabric.loader_version")}")
}

View File

@@ -0,0 +1,167 @@
package me.lucaslah.weatherchanger;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import me.lucaslah.weatherchanger.command.CommandManager;
import me.lucaslah.weatherchanger.commands.WeatherChangerCommand;
import me.lucaslah.weatherchanger.config.WcConfig;
import me.lucaslah.weatherchanger.config.WcMode;
import me.lucaslah.weatherchanger.keybinding.KeybindingManager;
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;
import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.nio.file.Files;
import java.util.Objects;
public class WeatherChanger {
private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
private static WcMode currentMode = WcMode.OFF;
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;
boolean fileCreated = false;
File configPath = getConfigFile();
if (!configPath.exists()) {
try {
fileCreated = configPath.createNewFile();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
if (fileCreated) {
writeConfig();
} else {
loadConfig();
}
keybindingManager = new KeybindingManager();
commandManager = new CommandManager();
keybindingManager
.add(new ToggleClearKey())
.add(new ToggleOffKey())
.add(new ToggleRainKey())
.add(new ToggleThunderKey());
commandManager.add(new WeatherChangerCommand());
weatherTimer = new Timer();
}
private static void loadConfig() {
Reader reader;
try {
reader = Files.newBufferedReader(getConfigFile().toPath());
} catch (IOException e) {
throw new RuntimeException(e);
}
WcConfig config = gson.fromJson(reader, WcConfig.class);
if (!Objects.equals(config.getVersion(), "1.0.0")) {
throw new RuntimeException("Invalid weather changer config version! Try removing the config file and try again.");
}
currentMode = config.getMode();
try {
reader.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
private static void writeConfig() {
WcConfig config = new WcConfig();
config.setMode(currentMode);
config.setVersion("1.0.0");
Writer writer;
try {
writer = Files.newBufferedWriter(getConfigFile().toPath());
} catch (IOException e) {
throw new RuntimeException(e);
}
gson.toJson(config, writer);
try {
writer.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
private static File getConfigFile() {
return platform.getConfigDirectory().resolve("weather-changer.json").toFile();
}
/**
* Reloads the config file from disk
* @return if the reload was successful
*/
public static boolean reloadConfig() {
if (getConfigFile().exists() && getConfigFile().isFile()) {
loadConfig();
return true;
}
return false;
}
/**
* Sets the current mode
* @param mode the mode
*/
public static void setMode(WcMode mode) {
currentMode = mode;
}
public static WcMode getMode() {
return currentMode;
}
/**
* Call on shutdown
*/
public static void shutdown() {
writeConfig();
}
public static KeybindingManager getKeybindingManager() {
return keybindingManager;
}
public static CommandManager getCommandManager() {
return commandManager;
}
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

@@ -0,0 +1,7 @@
package me.lucaslah.weatherchanger;
import java.nio.file.Path;
public interface WeatherChangerPlatform {
Path getConfigDirectory();
}

View File

@@ -0,0 +1,10 @@
package me.lucaslah.weatherchanger.command;
import com.mojang.brigadier.CommandDispatcher;
import net.minecraft.util.Identifier;
public abstract class Command {
public abstract <T> void register(CommandDispatcher<T> dispatcher);
public abstract Identifier getId();
public abstract boolean isEnabled();
}

View File

@@ -0,0 +1,28 @@
package me.lucaslah.weatherchanger.command;
import net.minecraft.util.Identifier;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class CommandManager {
private final HashMap<Identifier, Command> entries = new HashMap<>();
public CommandManager add(Command entry) {
entries.put(entry.getId(), entry);
return this;
}
public Command get(Identifier identifier) {
return entries.get(identifier);
}
public List<Command> getEntries() {
if (!entries.isEmpty()) {
return new ArrayList<>(entries.values());
}
return new ArrayList<>();
}
}

View File

@@ -0,0 +1,73 @@
package me.lucaslah.weatherchanger.commands;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.tree.LiteralCommandNode;
import me.lucaslah.weatherchanger.WeatherChanger;
import me.lucaslah.weatherchanger.command.Command;
import me.lucaslah.weatherchanger.config.WcMode;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import static me.lucaslah.weatherchanger.WeatherChanger.sendClientMessage;
public class WeatherChangerCommand extends Command {
@Override
public <T> void register(CommandDispatcher<T> dispatcher) {
LiteralArgumentBuilder<T> command = LiteralArgumentBuilder.literal("clientweather");
command.then(LiteralArgumentBuilder.<T>literal("off")
.executes(context -> {
WeatherChanger.setMode(WcMode.OFF);
sendClientMessage(Text.translatable("commands.weatherchanger.set.off"));
return 1;
})
);
command.then(LiteralArgumentBuilder.<T>literal("clear")
.executes(context -> {
WeatherChanger.setMode(WcMode.CLEAR);
sendClientMessage(Text.translatable("commands.weatherchanger.set.clear"));
return 1;
})
);
command.then(LiteralArgumentBuilder.<T>literal("rain")
.executes(context -> {
WeatherChanger.setMode(WcMode.RAIN);
sendClientMessage(Text.translatable("commands.weatherchanger.set.rain"));
return 1;
})
);
command.then(LiteralArgumentBuilder.<T>literal("thunder")
.executes(context -> {
WeatherChanger.setMode(WcMode.THUNDER);
sendClientMessage(Text.translatable("commands.weatherchanger.set.thunder"));
return 1;
})
);
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 Identifier.of("weatherchanger", "corecommand");
}
@Override
public boolean isEnabled() {
return true;
}
}

View File

@@ -0,0 +1,30 @@
package me.lucaslah.weatherchanger.config;
public class WcConfig {
private WcMode mode;
private String version;
public WcConfig() {
}
public WcConfig(WcMode mode, String version) {
this.mode = mode;
this.version = version;
}
public WcMode getMode() {
return mode;
}
public void setMode(WcMode mode) {
this.mode = mode;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
}

View File

@@ -0,0 +1,8 @@
package me.lucaslah.weatherchanger.config;
public enum WcMode {
OFF,
CLEAR,
RAIN,
THUNDER
}

View File

@@ -1,31 +1,26 @@
package me.lucaslah.weatherchanger.keybind;
package me.lucaslah.weatherchanger.keybinding;
import me.lucaslah.weatherchanger.WeatherChanger;
import org.jetbrains.annotations.NotNull;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil.Type;
import net.minecraft.client.util.InputUtil;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.NotNull;
public abstract class Key {
public KeyBinding keybind;
public WeatherChanger mod = WeatherChanger.getInstance();
public MinecraftClient mc = MinecraftClient.getInstance();
public Key(@NotNull String name) {
keybind = KeyBindingHelper.registerKeyBinding(new KeyBinding(this.getDisplayName(), this.getKeyType(), this.getKey(), this.getCategory()));
private static final KeyBinding.Category CATEGORY = KeyBinding.Category.create(Identifier.of("weatherchanger"));
public Key() {
keybind = new KeyBinding(this.getDisplayName(), this.getKeyType(), this.getKey(), CATEGORY);
}
public abstract void onPress(@NotNull MinecraftClient client);
public abstract Identifier getId();
public abstract KeyBinding getKeyBinding();
public abstract boolean isEnabled();
public abstract String getDisplayName();
public abstract Type getKeyType();
public abstract String getCategory();
public abstract InputUtil.Type getKeyType();
public abstract int getKey();
}

View File

@@ -0,0 +1,28 @@
package me.lucaslah.weatherchanger.keybinding;
import net.minecraft.util.Identifier;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class KeybindingManager {
private final HashMap<Identifier, Key> entries = new HashMap<>();
public KeybindingManager add(Key entry) {
entries.put(entry.getId(), entry);
return this;
}
public Key get(Identifier identifier) {
return entries.get(identifier);
}
public List<Key> getEntries() {
if (!entries.isEmpty()) {
return new ArrayList<>(entries.values());
}
return new ArrayList<>();
}
}

View File

@@ -1,28 +1,27 @@
package me.lucaslah.weatherchanger.keybindings;
package me.lucaslah.weatherchanger.keys;
import me.lucaslah.weatherchanger.keybind.Key;
import me.lucaslah.weatherchanger.WeatherChanger;
import me.lucaslah.weatherchanger.config.WcMode;
import me.lucaslah.weatherchanger.keybinding.Key;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.client.util.InputUtil;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.NotNull;
public class ToggleClearKey extends Key {
public ToggleClearKey() {
super("ToggleClearKey");
}
@Override
public void onPress(@NotNull MinecraftClient client) {
mod.setClear();
WeatherChanger.setMode(WcMode.CLEAR);
assert mc.player != null;
mc.player.sendMessage(Text.of("Set client weather to: Clear"), true);
mc.player.sendMessage(Text.translatable("commands.weatherchanger.set.clear"), true);
}
@Override
public Identifier getId() {
return new Identifier("weatherchangerkeys", "toggleclearkey");
return Identifier.of("weatherchanger", "toggleclearkey");
}
@Override
@@ -37,7 +36,7 @@ public class ToggleClearKey extends Key {
@Override
public String getDisplayName() {
return "Toggle Weather Clear";
return I18n.translate("keys.weatherchanger.clear.name");
}
@Override
@@ -45,11 +44,6 @@ public class ToggleClearKey extends Key {
return InputUtil.Type.KEYSYM;
}
@Override
public String getCategory() {
return "Weather Changer";
}
@Override
public int getKey() {
return -1;

View File

@@ -1,28 +1,27 @@
package me.lucaslah.weatherchanger.keybindings;
package me.lucaslah.weatherchanger.keys;
import me.lucaslah.weatherchanger.keybind.Key;
import me.lucaslah.weatherchanger.WeatherChanger;
import me.lucaslah.weatherchanger.config.WcMode;
import me.lucaslah.weatherchanger.keybinding.Key;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.client.util.InputUtil;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.NotNull;
public class ToggleOffKey extends Key {
public ToggleOffKey() {
super("ToggleOffKey");
}
@Override
public void onPress(@NotNull MinecraftClient client) {
mod.setOff();
WeatherChanger.setMode(WcMode.OFF);
assert mc.player != null;
mc.player.sendMessage(Text.of("Set client weather to: Off"), true);
mc.player.sendMessage(Text.translatable("commands.weatherchanger.set.off"), true);
}
@Override
public Identifier getId() {
return new Identifier("weatherchangerkeys", "toggleoffkey");
return Identifier.of("weatherchanger", "toggleoffkey");
}
@Override
@@ -37,7 +36,7 @@ public class ToggleOffKey extends Key {
@Override
public String getDisplayName() {
return "Toggle Weather Off";
return I18n.translate("keys.weatherchanger.off.name");
}
@Override
@@ -45,11 +44,6 @@ public class ToggleOffKey extends Key {
return InputUtil.Type.KEYSYM;
}
@Override
public String getCategory() {
return "Weather Changer";
}
@Override
public int getKey() {
return -1;

View File

@@ -1,28 +1,27 @@
package me.lucaslah.weatherchanger.keybindings;
package me.lucaslah.weatherchanger.keys;
import me.lucaslah.weatherchanger.keybind.Key;
import me.lucaslah.weatherchanger.WeatherChanger;
import me.lucaslah.weatherchanger.config.WcMode;
import me.lucaslah.weatherchanger.keybinding.Key;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.client.util.InputUtil;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.NotNull;
public class ToggleRainKey extends Key {
public ToggleRainKey() {
super("ToggleRainKey");
}
@Override
public void onPress(@NotNull MinecraftClient client) {
mod.setRain();
WeatherChanger.setMode(WcMode.RAIN);
assert mc.player != null;
mc.player.sendMessage(Text.of("Set client weather to: Rain"), true);
mc.player.sendMessage(Text.translatable("commands.weatherchanger.set.rain"), true);
}
@Override
public Identifier getId() {
return new Identifier("weatherchangerkeys", "togglerainkey");
return Identifier.of("weatherchanger", "togglerainkey");
}
@Override
@@ -37,7 +36,7 @@ public class ToggleRainKey extends Key {
@Override
public String getDisplayName() {
return "Toggle Weather Rain";
return I18n.translate("keys.weatherchanger.rain.name");
}
@Override
@@ -45,11 +44,6 @@ public class ToggleRainKey extends Key {
return InputUtil.Type.KEYSYM;
}
@Override
public String getCategory() {
return "Weather Changer";
}
@Override
public int getKey() {
return -1;

View File

@@ -1,28 +1,27 @@
package me.lucaslah.weatherchanger.keybindings;
package me.lucaslah.weatherchanger.keys;
import me.lucaslah.weatherchanger.keybind.Key;
import me.lucaslah.weatherchanger.WeatherChanger;
import me.lucaslah.weatherchanger.config.WcMode;
import me.lucaslah.weatherchanger.keybinding.Key;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.client.util.InputUtil;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.NotNull;
public class ToggleThunderKey extends Key {
public ToggleThunderKey() {
super("ToggleThunderKey");
}
@Override
public void onPress(@NotNull MinecraftClient client) {
mod.setThunder();
WeatherChanger.setMode(WcMode.THUNDER);
assert mc.player != null;
mc.player.sendMessage(Text.of("Set client weather to: Thunder"), true);
mc.player.sendMessage(Text.translatable("commands.weatherchanger.set.thunder"), true);
}
@Override
public Identifier getId() {
return new Identifier("weatherchangerkeys", "togglethunderkey");
return Identifier.of("weatherchanger", "togglethunderkey");
}
@Override
@@ -37,7 +36,7 @@ public class ToggleThunderKey extends Key {
@Override
public String getDisplayName() {
return "Toggle Weather Thunder";
return I18n.translate("keys.weatherchanger.thunder.name");
}
@Override
@@ -45,11 +44,6 @@ public class ToggleThunderKey extends Key {
return InputUtil.Type.KEYSYM;
}
@Override
public String getCategory() {
return "Weather Changer";
}
@Override
public int getKey() {
return -1;

View File

@@ -0,0 +1,94 @@
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
protected float lastRainGradient;
@Shadow
protected float rainGradient;
@Shadow
protected float lastThunderGradient;
@Shadow
protected float thunderGradient;
@Shadow @Final private RegistryEntry<DimensionType> dimensionEntry;
@Unique
private float weatherChanger$getRainGradientOg(float delta) {
return MathHelper.lerp(delta, this.lastRainGradient, this.rainGradient);
}
@Unique
private float weatherChanger$getThunderGradientOg(float delta) {
return MathHelper.lerp(delta, this.lastThunderGradient, 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();
if (mode == WcMode.CLEAR) {
callback.setReturnValue(0F);
} else if (mode == WcMode.RAIN || mode == WcMode.THUNDER) {
callback.setReturnValue(1F);
} else {
callback.setReturnValue(MathHelper.lerp(delta, this.lastRainGradient, this.rainGradient));
}
callback.cancel();
}
@Inject(method = "getThunderGradient", at = @At("HEAD"), cancellable = true)
public void getThunderGradient(float delta, CallbackInfoReturnable<Float> callback) {
WcMode mode = WeatherChanger.getMode();
if (mode == WcMode.CLEAR) {
callback.setReturnValue(0F);
} else if (mode == WcMode.THUNDER) {
callback.setReturnValue(1F);
} else {
callback.setReturnValue(MathHelper.lerp(delta, this.lastThunderGradient, this.thunderGradient) * MathHelper.lerp(delta, this.lastRainGradient, this.rainGradient));
}
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

@@ -0,0 +1,3 @@
{
"accessWidener": "weatherchanger.accesswidener"
}

View File

@@ -0,0 +1,13 @@
{
"key.category.minecraft.weatherchanger": "Weather Changer",
"commands.weatherchanger.set.off": "Set client weather to: Off",
"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",
"keys.weatherchanger.thunder.name": "Toggle Weather Thunder"
}

View File

@@ -0,0 +1,13 @@
{
"modmenu.descriptionTranslation.weatherchanger": "Позволяет изменять погоду в клиенте, не изменяя погоду сервера.",
"commands.weatherchanger.set.off": "Установлена клиентская погода: Выкл.",
"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": "Переключить дождливую погоду",
"keys.weatherchanger.thunder.name": "Переключить дождливую и грозовую погоду"
}

View File

@@ -0,0 +1,14 @@
{
"modmenu.summaryTranslation.weatherchanger": "Клиент тарафыннан Minecraft һава торышын үзгәртү",
"modmenu.descriptionTranslation.weatherchanger": "Сервер тарафыннан һава торышын үзгәртмичә, клиент тарафыннан Minecraft һава торышын үзгәртү",
"commands.weatherchanger.set.off": "Клиентлы һава торышы урнаштырылды: Сүнек",
"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": "Яңгырлы һава торышын күчерү",
"keys.weatherchanger.thunder.name": "Яшенле һәм яңгырлы һава торышын күчерү"
}

View File

@@ -0,0 +1 @@
accessWidener v2 named

View File

@@ -2,7 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "me.lucaslah.weatherchanger.mixin",
"compatibilityLevel": "JAVA_17",
"compatibilityLevel": "JAVA_21",
"mixins": [
],
"client": [
@@ -10,5 +10,6 @@
],
"injectors": {
"defaultRequire": 1
}
}
},
"refmap": "weatherchanger-common-common-refmap.json"
}

86
fabric/build.gradle.kts Normal file
View File

@@ -0,0 +1,86 @@
architectury {
platformSetupLoomIde()
fabric()
}
loom {
accessWidenerPath = project(":common").loom.accessWidenerPath
}
val common: Configuration by configurations.creating
val shadowCommon: Configuration by configurations.creating
configurations {
compileOnly.configure { extendsFrom(common) }
runtimeOnly.configure { extendsFrom(common) }
}
dependencies {
modImplementation("net.fabricmc:fabric-loader:${rootProject.property("fabric.loader_version")}")
modImplementation("net.fabricmc.fabric-api:fabric-api:${rootProject.property("fabric.version")}")
common(project(":common", "namedElements")) {
isTransitive = false
}
shadowCommon(project(":common", "transformProductionFabric")){
isTransitive = false
}
}
tasks {
processResources {
inputs.property("version", project.version)
filesMatching("fabric.mod.json") {
expand(mapOf(
"version" to project.version,
"mod_id" to rootProject.property("mod_id"),
"minecraft_version" to rootProject.property("minecraft_version"),
"minecraft_base_version" to rootProject.property("minecraft_base"),
"fabric_loader_version" to rootProject.property("fabric.loader_version")
))
}
exclude("architectury.common.json")
}
remapJar {
injectAccessWidener.set(true)
}
jar {
from("../LICENSE.md")
from("../assets/logo.png") {
rename { "assets/weatherchanger/icon.png" }
}
rename("common-common-refmap.json", "weatherchanger-common-common-refmap.json")
dependsOn(":common:transformProductionFabric")
from({
shadowCommon.filter { it.name.endsWith("jar") }.map { zipTree(it) }
})
}
}
java {
withSourcesJar()
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}

View File

@@ -0,0 +1,39 @@
package me.lucaslah.weatherchanger.fabric;
import me.lucaslah.weatherchanger.WeatherChanger;
import me.lucaslah.weatherchanger.command.Command;
import me.lucaslah.weatherchanger.keybinding.Key;
import me.lucaslah.weatherchanger.keybinding.KeybindingManager;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
public class WeatherChangerFabric implements ClientModInitializer {
@Override
public void onInitializeClient() {
WeatherChanger.init(new WeatherChangerPlatformImpl());
ClientLifecycleEvents.CLIENT_STOPPING.register(client -> WeatherChanger.shutdown());
KeybindingManager keybindingManager = WeatherChanger.getKeybindingManager();
for (Key key : keybindingManager.getEntries()) {
KeyBindingHelper.registerKeyBinding(key.getKeyBinding());
}
ClientTickEvents.END_CLIENT_TICK.register(client -> {
for (Key key : keybindingManager.getEntries()) {
if (key.isEnabled() && key.getKeyBinding().wasPressed()) {
key.onPress(client);
}
}
});
ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
for (Command command : WeatherChanger.getCommandManager().getEntries()) {
command.register(dispatcher);
}
});
}
}

View File

@@ -0,0 +1,13 @@
package me.lucaslah.weatherchanger.fabric;
import me.lucaslah.weatherchanger.WeatherChangerPlatform;
import net.fabricmc.loader.api.FabricLoader;
import java.nio.file.Path;
public class WeatherChangerPlatformImpl implements WeatherChangerPlatform {
@Override
public Path getConfigDirectory() {
return FabricLoader.getInstance().getConfigDir();
}
}

View File

@@ -0,0 +1,31 @@
{
"schemaVersion": 1,
"id": "${mod_id}",
"version": "${version}",
"name": "WeatherChanger",
"description": "Client side weather change for Minecraft",
"authors": [
"Lucaslah"
],
"contact": {
"sources": "https://github.com/Lucaslah/WeatherChanger",
"homepage": "https://lucaslah.github.com/WeatherChanger",
"issues": "https://github.com/Lucaslah/WeatherChanger/issues"
},
"license": "LGPL-3.0",
"icon": "assets/weatherchanger/icon.png",
"environment": "client",
"entrypoints": {
"client": [
"me.lucaslah.weatherchanger.fabric.WeatherChangerFabric"
]
},
"mixins": [
"weatherchanger.mixins.json"
],
"depends": {
"fabricloader": ">=${fabric_loader_version}",
"fabric": "*",
"minecraft": ">=${minecraft_base_version}"
}
}

93
forge/build.gradle.kts Normal file
View File

@@ -0,0 +1,93 @@
architectury {
platformSetupLoomIde()
forge()
}
loom {
accessWidenerPath.set(project(":common").loom.accessWidenerPath)
forge.apply {
convertAccessWideners.set(true)
extraAccessWideners.add(loom.accessWidenerPath.get().asFile.name)
mixinConfig("weatherchanger.mixins.json")
}
}
val common: Configuration by configurations.creating
val shadowCommon: Configuration by configurations.creating
configurations {
compileOnly.configure { extendsFrom(common) }
runtimeOnly.configure { extendsFrom(common) }
}
dependencies {
forge("net.minecraftforge:forge:${rootProject.property("forge.version")}")
common(project(":common", "namedElements")) {
isTransitive = false
}
shadowCommon(project(":common", "transformProductionForge")) {
isTransitive = false
}
}
tasks {
processResources {
inputs.property("group", rootProject.property("maven_group"))
inputs.property("version", project.version)
filesMatching("META-INF/mods.toml") {
expand(mapOf(
"group" to rootProject.property("maven_group"),
"version" to project.version,
"mod_id" to rootProject.property("mod_id"),
"minecraft_version" to rootProject.property("minecraft_version")
))
}
exclude("architectury.common.json")
}
remapJar {
injectAccessWidener.set(true)
}
jar {
from("../LICENSE.md")
from("../assets/logo.png") {
rename { "icon.png" }
}
rename("common-common-refmap.json", "weatherchanger-common-common-refmap.json")
dependsOn(":common:transformProductionForge")
from({
shadowCommon.filter { it.name.endsWith("jar") }.map { zipTree(it) }
})
}
}
java {
withSourcesJar()
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}

1
forge/gradle.properties Normal file
View File

@@ -0,0 +1 @@
loom.platform=forge

View File

@@ -0,0 +1,61 @@
package me.lucaslah.weatherchanger.forge;
import me.lucaslah.weatherchanger.WeatherChanger;
import me.lucaslah.weatherchanger.command.Command;
import me.lucaslah.weatherchanger.command.CommandManager;
import me.lucaslah.weatherchanger.keybinding.Key;
import me.lucaslah.weatherchanger.keybinding.KeybindingManager;
import net.minecraft.client.MinecraftClient;
import net.minecraftforge.client.event.RegisterClientCommandsEvent;
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
@Mod("weatherchanger")
public class WeatherChangerForge {
private final KeybindingManager keybindingManager;
private final CommandManager commandManager;
public WeatherChangerForge() {
WeatherChanger.init(new WeatherChangerPlatformImpl());
keybindingManager = WeatherChanger.getKeybindingManager();
commandManager = WeatherChanger.getCommandManager();
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
modEventBus.addListener(this::onClientSetup);
modEventBus.addListener(this::registerBindings);
}
private void onClientSetup(FMLClientSetupEvent event) {
MinecraftForge.EVENT_BUS.register(this);
}
public void registerBindings(RegisterKeyMappingsEvent event) {
for (Key key : keybindingManager.getEntries()) {
event.register(key.getKeyBinding());
}
}
@SubscribeEvent
public void onClientTick(TickEvent.ClientTickEvent event) {
if (event.phase == TickEvent.Phase.END) {
for (Key key : keybindingManager.getEntries()) {
if (key.isEnabled() && key.getKeyBinding().wasPressed()) {
key.onPress(MinecraftClient.getInstance());
}
}
}
}
@SubscribeEvent
public void onCommandRegister(RegisterClientCommandsEvent event) {
for (Command command : commandManager.getEntries()) {
command.register(event.getDispatcher());
}
}
}

View File

@@ -0,0 +1,13 @@
package me.lucaslah.weatherchanger.forge;
import me.lucaslah.weatherchanger.WeatherChangerPlatform;
import net.minecraftforge.fml.loading.FMLPaths;
import java.nio.file.Path;
public class WeatherChangerPlatformImpl implements WeatherChangerPlatform {
@Override
public Path getConfigDirectory() {
return FMLPaths.CONFIGDIR.get();
}
}

View File

@@ -0,0 +1,28 @@
modLoader = "javafml"
loaderVersion = "[4,)"
issueTrackerURL = "https://github.com/Lucaslah/WeatherChanger/issues"
license = "LGPL-3.0"
[[mods]]
modId = "${mod_id}"
version = "${version}"
displayName = "Weather Changer"
authors = "Lucaslah"
description = '''
Client side weather change for Minecraft
'''
logoFile = "icon.png"
[[dependencies.${mod_id}]]
modId = "forge"
mandatory = true
versionRange = "[43,)"
ordering = "NONE"
side = "CLIENT"
[[dependencies.${mod_id}]]
modId = "minecraft"
mandatory = true
versionRange = "[${minecraft_version},)"
ordering = "NONE"
side = "CLIENT"

View File

@@ -0,0 +1,6 @@
{
"pack": {
"description": "Weather Changer",
"pack_format": 9
}
}

View File

@@ -1,17 +1,30 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.jvmargs=-Xmx2G
# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.1
loader_version=0.14.8
# Kotlin
kotlin.code.style=official
# Minecraft Properties
minecraft_version=1.21.11
minecraft_base=1.21
yarn_mappings=1.21.11+build.1
# Architectury Properties
enabled_platforms=fabric,forge
# Mod Properties
mod_version = 0.1.0
version = 0.1.0
maven_group = me.lucaslah
mod_version = 1.3.0-beta1
mod_id = weatherchanger
maven_group = me.lucaslah.weatherchanger
archives_base_name = weather-changer
# Dependencies
fabric_version=0.58.6+1.19.2
# Release Properties
# options: alpha,beta,release
release_channel=release
# Fabric
fabric.loader_version=0.18.2
fabric.version=0.139.4+1.21.11
# Forge
forge.version=1.21-51.0.21

Binary file not shown.

View File

@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

51
gradlew vendored
View File

@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -32,10 +32,10 @@
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
@@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +80,11 @@ do
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -133,22 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
@@ -205,6 +214,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.

35
gradlew.bat vendored
View File

@@ -14,7 +14,7 @@
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@@ -40,13 +41,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal

View File

@@ -1,10 +0,0 @@
pluginManagement {
repositories {
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
mavenCentral()
gradlePluginPortal()
}
}

41
settings.gradle.kts Normal file
View File

@@ -0,0 +1,41 @@
rootProject.name = "WeatherChanger"
pluginManagement {
repositories {
maven {
name = "Fabric"
url = uri("https://maven.fabricmc.net/")
}
maven {
name = "Forge"
url = uri("https://maven.minecraftforge.net/")
}
maven {
name = "Architectury"
url = uri("https://maven.architectury.dev/")
}
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id("com.gradle.enterprise") version("3.15.1")
}
gradleEnterprise {
if (System.getenv("CI") != null) {
buildScan {
publishAlways()
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
}
}
}
include("common")
include("fabric")
//include("forge")

View File

@@ -1,19 +0,0 @@
package me.lucaslah.weatherchanger;
public class Config {
private String mode;
public Config() {}
public Config(String mode) {
this.mode = mode;
}
public String getMode() {
return mode;
}
public void setMode(String mode) {
this.mode = mode;
}
}

View File

@@ -1,158 +0,0 @@
package me.lucaslah.weatherchanger;
import com.google.gson.Gson;
import me.lucaslah.weatherchanger.keybind.KeybindManager;
import me.lucaslah.weatherchanger.keybindings.ToggleClearKey;
import me.lucaslah.weatherchanger.keybindings.ToggleOffKey;
import me.lucaslah.weatherchanger.keybindings.ToggleRainKey;
import me.lucaslah.weatherchanger.keybindings.ToggleThunderKey;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.text.Text;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.nio.file.Files;
public class WeatherChanger implements ModInitializer {
public static WeatherChanger instance;
public static final Logger LOGGER = LogManager.getLogger("weather-changer");
public Mode mode = Mode.OFF;
@Override
public void onInitialize() {
instance = this;
// Create config if it does not exist
File configFile = new File(FabricLoader.getInstance().getConfigDir().resolve("weather-changer.json").toUri());
if (!configFile.exists()) {
try {
configFile.createNewFile();
writeModeToConfig();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
loadModeFromFile();
// Keybindings
new KeybindManager()
.add(new ToggleOffKey())
.add(new ToggleClearKey())
.add(new ToggleRainKey())
.add(new ToggleThunderKey());
// Command
ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> dispatcher.register(ClientCommandManager.literal("clientweather")
.then(ClientCommandManager.literal("off")
.executes(context -> {
setOff();
context.getSource().sendFeedback(Text.literal("Set client weather to: Off"));
return 1;
})
).then(ClientCommandManager.literal("clear")
.executes(context -> {
setClear();
context.getSource().sendFeedback(Text.literal("Set client weather to: Clear"));
return 1;
})
).then(ClientCommandManager.literal("rain")
.executes(context -> {
setRain();
context.getSource().sendFeedback(Text.literal("Set client weather to: Rain"));
return 1;
})
).then(ClientCommandManager.literal("thunder")
.executes(context -> {
setThunder();
context.getSource().sendFeedback(Text.literal("Set client weather to: Thunder"));
return 1;
})
).executes((context -> {
context.getSource().sendFeedback(Text.literal("Client weather is set to: " + getMode().toString().toLowerCase()));
return 1;
}))
));
}
public static WeatherChanger getInstance() {
return instance;
}
public enum Mode {
OFF,
CLEAR,
RAIN,
THUNDER
}
public void setMode(Mode mode) {
this.mode = mode;
}
public Mode getMode() {
return mode;
}
public void writeModeToConfig() {
Gson gson = new Gson();
Config config = new Config(getMode().toString().toUpperCase());
Writer writer;
try {
writer = Files.newBufferedWriter(FabricLoader.getInstance().getConfigDir().resolve("weather-changer.json"));
} catch (IOException e) {
throw new RuntimeException(e);
}
gson.toJson(config, writer);
try {
writer.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public void loadModeFromFile() {
Gson gson = new Gson();
Reader reader = null;
try {
reader = Files.newBufferedReader(FabricLoader.getInstance().getConfigDir().resolve("weather-changer.json"));
} catch (IOException e) {
throw new RuntimeException(e);
}
Config config = gson.fromJson(reader, Config.class);
setMode(Mode.valueOf(config.getMode().toUpperCase()));
try {
reader.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public void setOff() {
setMode(Mode.OFF);
writeModeToConfig();
}
public void setClear() {
setMode(Mode.CLEAR);
writeModeToConfig();
}
public void setRain() {
setMode(Mode.RAIN);
writeModeToConfig();
}
public void setThunder() {
setMode(Mode.THUNDER);
writeModeToConfig();
}
}

View File

@@ -1,46 +0,0 @@
package me.lucaslah.weatherchanger.keybind;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.minecraft.util.Identifier;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class KeybindManager {
private final HashMap<Identifier, Key> entries = new HashMap<>();
private static KeybindManager INSTANCE;
public KeybindManager() {
INSTANCE = this;
ClientTickEvents.END_CLIENT_TICK.register(client -> {
for (Key key : getEntries()) {
if (key.isEnabled() && key.getKeyBinding().wasPressed()) {
key.onPress(client);
}
}
});
}
public KeybindManager add(Key entry) {
entries.put(entry.getId(), entry);
return this;
}
public Key get(Identifier identifier) {
return entries.get(identifier);
}
public List<Key> getEntries() {
if (entries.size() > 0) {
return new ArrayList<>(entries.values());
}
return new ArrayList<>();
}
public static KeybindManager getInstance() {
return INSTANCE;
}
}

View File

@@ -1,48 +0,0 @@
package me.lucaslah.weatherchanger.mixin;
import me.lucaslah.weatherchanger.WeatherChanger;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.profiler.Profiler;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.MutableWorldProperties;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import org.spongepowered.asm.mixin.Mixin;
import java.util.function.Supplier;
@Mixin(ClientWorld.class)
public abstract class WorldMixin extends World {
protected WorldMixin(MutableWorldProperties properties, RegistryKey<World> registryRef, RegistryEntry<DimensionType> dimension, Supplier<Profiler> profiler, boolean isClient, boolean debugWorld, long seed, int maxChainedNeighborUpdates) {
super(properties, registryRef, dimension, profiler, isClient, debugWorld, seed, maxChainedNeighborUpdates);
}
private WeatherChanger mod = WeatherChanger.getInstance();
@Override
public float getRainGradient(float delta) {
if (mod.mode == WeatherChanger.Mode.OFF) {
return super.getRainGradient(delta);
} else if (mod.mode == WeatherChanger.Mode.CLEAR) {
return 0;
} else if (mod.mode == WeatherChanger.Mode.RAIN || mod.mode == WeatherChanger.Mode.THUNDER) {
return 1;
}
return super.getRainGradient(delta);
}
@Override
public float getThunderGradient(float delta) {
if (mod.mode == WeatherChanger.Mode.OFF) {
return super.getRainGradient(delta);
} else if (mod.mode == WeatherChanger.Mode.CLEAR) {
return 0;
} else if (mod.mode == WeatherChanger.Mode.THUNDER) {
return 1;
}
return super.getRainGradient(delta);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -1,36 +0,0 @@
{
"schemaVersion": 1,
"id": "weather-changer",
"version": "${version}",
"name": "Weather Changer",
"description": "Client side weather changer",
"authors": [
"Lucaslah"
],
"contact": {
"homepage": "https://cssudii.xyz/r/project/oss/weather-changer",
"sources": "https://github.com/Lucaslah/WeatherChanger",
"issues": "https://github.com/Lucaslah/WeatherChanger/issues",
"email": "ossprojects@cssudii.xyz"
},
"license": "lgpl-3",
"icon": "assets/weatherchanger/icon.png",
"environment": "*",
"entrypoints": {
"main": [
"me.lucaslah.weatherchanger.WeatherChanger"
]
},
"mixins": [
"mixins.json"
],
"depends": {
"fabricloader": ">=0.14.6",
"minecraft": "~1.19",
"java": ">=17"
}
}