diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml
index 9e3b233a..a835a44a 100644
--- a/.github/workflows/auto-release.yml
+++ b/.github/workflows/auto-release.yml
@@ -1,73 +1,61 @@
-# This workflow will build a Java project with Gradle
-# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
-
-name: auto-release
-
-on:
- push:
- tags:
- - 'v*'
-
-jobs:
- first:
- name: Check release tag
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v4
-
- - run: |
- prop() { grep -P "^\s*[^#]?${1}=.*$" './gradle.properties' | cut -d'=' -f2; }
- echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- echo "MOD_VERSION=`echo $(prop "mod_version")`" >> $GITHUB_ENV
-
- - run: if [ "${{env.GIT_TAG}}" != "v${{env.MOD_VERSION}}" ];then exit 1;fi
-
- second:
- name: Build and publish
- runs-on: ubuntu-latest
- needs: first
- permissions:
- contents: write
- packages: write
-
- steps:
- - uses: actions/checkout@v4
-
- - name: Set up JDK 17
- uses: actions/setup-java@v4
- with:
- java-version: '17'
- distribution: 'temurin'
- architecture: 'x64'
- cache: 'gradle'
-
- - name: Build and publish with Gradle
- env:
- IS_RELEASE: true
- GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- ORG_GRADLE_PROJECT_signingKey: ${{secrets.RELEASE_SIGNING_GPG_PRIVATE_KEY}}
- ORG_GRADLE_PROJECT_signingPassword: ${{secrets.RELEASE_SIGNING_GPG_PASSPHRASE}}
- AUIOC_MAVEN_USERNAME: ${{secrets.AUIOC_MAVEN_USERNAME}}
- AUIOC_MAVEN_TOKEN: ${{secrets.AUIOC_MAVEN_TOKEN}}
- run: |
- chmod +x ./gradlew
- ./gradlew runData
- ./gradlew build publish generateUpdateJson
- mkdir ./pages
- cp -r ./build/tmp/update/. ./pages/
-
- - name: Update update JSON
- uses: JamesIves/github-pages-deploy-action@v4
- with:
- clean: false
- target-folder: update
- branch: gh-pages
- folder: pages
-
- - name: Github release
- uses: softprops/action-gh-release@v1
- with:
- files: |
- build/libs/*.jar
- build/libs/*.asc
+name: auto-release
+
+on:
+ push:
+ tags:
+ - 'v*'
+
+jobs:
+ first:
+ name: Check release tag
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - run: |
+ prop() { grep -P "^\s*[^#]?${1}=.*$" './gradle.properties' | cut -d'=' -f2; }
+ echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
+ echo "MOD_VERSION=`echo $(prop "mod_version")`" >> $GITHUB_ENV
+
+ - run: if [ "${{env.GIT_TAG}}" != "v${{env.MOD_VERSION}}" ];then exit 1;fi
+
+ second:
+ name: Build and publish
+ runs-on: ubuntu-latest
+ needs: first
+ permissions:
+ contents: write
+ packages: write
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: recursive
+
+ - name: Set up JDK 21
+ uses: actions/setup-java@v4
+ with:
+ java-version: '21'
+ distribution: 'temurin'
+ architecture: 'x64'
+ cache: 'gradle'
+
+ - name: Build and publish with Gradle
+ env:
+ IS_RELEASE: true
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
+ ORG_GRADLE_PROJECT_signingKey: ${{secrets.RELEASE_SIGNING_GPG_PRIVATE_KEY}}
+ ORG_GRADLE_PROJECT_signingPassword: ${{secrets.RELEASE_SIGNING_GPG_PASSPHRASE}}
+ AUIOC_MAVEN_USERNAME: ${{secrets.AUIOC_MAVEN_USERNAME}}
+ AUIOC_MAVEN_TOKEN: ${{secrets.AUIOC_MAVEN_TOKEN}}
+ run: |
+ chmod +x ./gradlew
+ ./gradlew build publish
+
+ - name: Github release
+ uses: softprops/action-gh-release@v1
+ with:
+ files: |
+ build/libs/*.jar
+ build/libs/*.asc
diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml
index 93467852..7ad324af 100644
--- a/.github/workflows/dev-build.yml
+++ b/.github/workflows/dev-build.yml
@@ -1,6 +1,3 @@
-# This workflow will build a Java project with Gradle
-# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
-
name: dev-build
on:
@@ -18,11 +15,13 @@ jobs:
steps:
- uses: actions/checkout@v4
+ with:
+ submodules: recursive
- - name: Set up JDK 17
+ - name: Set up JDK 21
uses: actions/setup-java@v4
with:
- java-version: '17'
+ java-version: '21'
distribution: 'temurin'
architecture: 'x64'
cache: 'gradle'
@@ -30,12 +29,11 @@ jobs:
- name: Build with Gradle
run: |
chmod +x ./gradlew
- ./gradlew runData
./gradlew build
echo "ARTIFACT_NAME=`cat ./build/tmp/artifact-name.txt`" >> $GITHUB_ENV
- name: Upload build artifacts
- uses: actions/upload-artifact@v1
+ uses: actions/upload-artifact@v4
with:
name: ${{env.ARTIFACT_NAME}}
path: build/libs
diff --git a/.gitignore b/.gitignore
index 1957d4d1..05bc46cf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,21 +11,19 @@ out
*.ipr
*.iws
*.iml
-.idea
-
-# vscode
-.vscode
+.idea/*
+!.idea/copyright
+!.idea/scopes
# gradle
build
.gradle
# other
-**/test/DevTest*.java
-src/generated
eclipse
run
runs
run-data
+src/generated
repo
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 00000000..e0de95c9
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "scripts"]
+ path = scripts
+ url = git@github.com:auioc/mcmod-scripts.git
diff --git a/.idea/copyright/auioc_mcmod_gplv3.xml b/.idea/copyright/auioc_mcmod_gplv3.xml
new file mode 100644
index 00000000..da2f44d7
--- /dev/null
+++ b/.idea/copyright/auioc_mcmod_gplv3.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
new file mode 100644
index 00000000..6866eeac
--- /dev/null
+++ b/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/scopes/src_auioc.xml b/.idea/scopes/src_auioc.xml
new file mode 100644
index 00000000..8e5aa977
--- /dev/null
+++ b/.idea/scopes/src_auioc.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/scopes/src_coremods.xml b/.idea/scopes/src_coremods.xml
new file mode 100644
index 00000000..a2e556db
--- /dev/null
+++ b/.idea/scopes/src_coremods.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index b3cdfe9d..4c298fe5 100644
--- a/README.md
+++ b/README.md
@@ -4,19 +4,23 @@
Shared library for AH's Minecraft mods.
+**! 1.21 Porting is in Progress !**
+
[![GitHub license](https://img.shields.io/github/license/auioc/arnicalib-mcmod?style=flat-square)](/LICENSE)
-[![GitHub release](https://img.shields.io/github/v/release/auioc/arnicalib-mcmod?style=flat-square)](https://github.com/auioc/arnicalib-mcmod/releases/latest)
+
+![Minecraft](https://img.shields.io/static/v1?label=Minecraft&message=1.21.4&color=00aa00&style=flat-square)
+[![NeoForge](https://img.shields.io/static/v1?label=NeoForge&message=21.4.50-beta&color=e04e14&style=flat-square)](https://neoforged.net/)
![Mappings](https://img.shields.io/static/v1?label=Mappings&message=parchment&color=00aa00&style=flat-square)
-![OpenJDK](https://img.shields.io/static/v1?label=OpenJDK&message=17&color=brightgreen&logo=java&style=flat-square)
-[![Gradle](https://img.shields.io/static/v1?label=Gradle&message=8.1.1&color=brightgreen&logo=gradle&style=flat-square)](https://docs.gradle.org/8.1.1/release-notes.html)
+![OpenJDK](https://img.shields.io/static/v1?label=OpenJDK&message=21&color=brightgreen&logo=java&style=flat-square)
+[![Gradle](https://img.shields.io/static/v1?label=Gradle&message=8.11.1&color=brightgreen&logo=gradle&style=flat-square)](https://docs.gradle.org/8.11.1/release-notes.html)
+
+
## Maintainers
- [@WakelessSloth56](https://github.com/WakelessSloth56)
diff --git a/build.gradle b/build.gradle
index 42237414..7da9e3dd 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,33 +1,128 @@
plugins {
id 'java-library'
- id 'eclipse'
- id 'idea'
id 'maven-publish'
- id 'net.neoforged.gradle.userdev' version '7.0.80'
+ id 'net.neoforged.moddev' version '1.0.23'
+ id 'idea'
+}
+
+tasks.named('wrapper', Wrapper).configure {
+ distributionType = Wrapper.DistributionType.BIN
}
-java.toolchain.languageVersion = JavaLanguageVersion.of(17)
+version = mod_version
+group = mod_group_id
+
+repositories {
+ mavenLocal()
+}
+
+base {
+ archivesName = mod_id
+}
+
+java.toolchain.languageVersion = JavaLanguageVersion.of(21)
+
+neoForge {
+ version = project.neo_version
+
+ parchment {
+ mappingsVersion = project.parchment_mappings_version
+ minecraftVersion = project.parchment_minecraft_version
+ }
+
+ // This line is optional. Access Transformers are automatically detected
+ // accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')
+
+ runs {
+ client {
+ client()
+ systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
+ }
+
+ server {
+ server()
+ programArgument '--nogui'
+ systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
+ }
-repositories {}
-dependencies {}
+ gameTestServer {
+ type = "gameTestServer"
+ systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
+ }
-apply from: "${scripts_url}/minecraft/neo/minecraft.gradle"
-runs {
- configureEach {
- // systemProperty 'forge.logging.markers', 'REGISTRIES'
- systemProperty 'forge.logging.console.level', 'debug'
- systemProperty 'mixin.debug', 'true'
+ serverData {
+ serverData()
+ programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
+ }
+
+ clientData {
+ clientData()
+ programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
+ }
+
+ configureEach {
+ // "SCAN": For mods scan.
+ // "REGISTRIES": For firing of registry events.
+ // "REGISTRYDUMP": For getting the contents of all registries.
+ systemProperty 'forge.logging.markers', 'REGISTRIES'
+
+ logLevel = org.slf4j.event.Level.DEBUG
+ }
+ }
+
+ mods {
+ "${mod_id}" {
+ sourceSet(sourceSets.main)
+ }
}
}
-apply from: "${scripts_url}/minecraft/neo/resources.gradle"
-apply from: "${scripts_url}/minecraft/neo/build-info.gradle"
-apply from: "${scripts_url}/minecraft/neo/artifacts.gradle"
-apply from: "${scripts_url}/minecraft/neo/publishing.gradle"
-apply from: "${scripts_url}/common/signing.gradle"
-apply from: "${scripts_url}/minecraft/neo/custom-clean.gradle"
-apply from: "${scripts_url}/minecraft/neo/update-json.gradle"
+sourceSets.main.resources { srcDir 'src/generated/resources' }
+
+configurations {
+ runtimeClasspath.extendsFrom localRuntime
+}
+
+dependencies {
+ // Example mod dependency using a mod jar from ./libs with a flat dir repository
+ // This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
+ // The group id is ignored when searching -- in this case, it is "blank"
+ // implementation "blank:coolmod-${mc_version}:${coolmod_version}"
-tasks.withType(JavaCompile).configureEach {
- options.encoding = 'UTF-8'
+ // Example mod dependency using a file as dependency
+ // implementation files("libs/coolmod-${mc_version}-${coolmod_version}.jar")
+}
+
+var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
+ var replaceProperties = [
+ minecraft_version : minecraft_version,
+ minecraft_version_range: minecraft_version_range,
+ neo_version : neo_version,
+ neo_version_range : neo_version_range,
+ loader_version_range : loader_version_range,
+ mod_id : mod_id,
+ mod_name : mod_name,
+ mod_license : mod_license,
+ mod_version : mod_version,
+ mod_authors : mod_authors,
+ mod_description : mod_description
+ ]
+
+ inputs.properties replaceProperties
+ expand replaceProperties
+ from "src/main/templates"
+ into "build/generated/sources/modMetadata"
+}
+sourceSets.main.resources.srcDir generateModMetadata
+neoForge.ideSyncTask generateModMetadata
+
+apply from: 'scripts/gradle/build-info.gradle'
+apply from: 'scripts/gradle/artifacts.gradle'
+apply from: 'scripts/gradle/publishing.gradle'
+
+idea {
+ module {
+ downloadSources = true
+ downloadJavadoc = true
+ }
}
diff --git a/gradle.properties b/gradle.properties
index 4a2db5ea..59dbafe2 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,25 +1,23 @@
-# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
-#org.gradle.jvmargs=
-org.gradle.daemon=false
-org.gradle.debug=false
+org.gradle.jvmargs=-Xmx1G
+org.gradle.daemon=true
+org.gradle.parallel=true
+org.gradle.caching=true
+org.gradle.configuration-cache=false
-scripts_url=https://hi.auioc.org/gradle-scripts
+parchment_minecraft_version=1.21.4
+parchment_mappings_version=2025.01.05
-neogradle.subsystems.parchment.minecraftVersion=1.20.3
-neogradle.subsystems.parchment.mappingsVersion=2023.12.31
-
-minecraft_version=1.20.4
-minecraft_version_range=[1.20.4,1.21)
-neo_version=20.4.80-beta
-neo_version_range=[20.4,)
-loader_version_range=[2,)
+minecraft_version=1.21.4
+minecraft_version_range=[1.21.4, 1.22)
+neo_version=21.4.50-beta
+neo_version_range=[21.4.50-beta,)
+loader_version_range=[4,)
mod_repository=auioc/arnicalib-mcmod
mod_id=arnicalib
mod_name=ArnicaLib
-mod_group_id=org.auioc.mcmod
-mod_version=6.1.3
mod_license=GNU GPLv3
-mod_authors=WakelessSloth56, LainIO24
-mod_credits=AUIOC
-mod_description=Shared library for AH's Minecraft mods.
+mod_version=7.0.0
+mod_group_id=org.auioc.mcmod
+mod_authors=AUIOC.ORG
+mod_description=ArnicaLib
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 943f0cbf..a4b76b95 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 37aef8d3..e2847c82 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index 65dcd68d..f5feea6d 100644
--- a/gradlew
+++ b/gradlew
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+# SPDX-License-Identifier: Apache-2.0
+#
##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
-# https://github.com/gradle/gradle/blob/HEAD/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/.
@@ -83,10 +85,9 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
-APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
-
-# 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 -P "${APP_HOME:-./}" > /dev/null && printf '%s
+' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -133,10 +134,13 @@ 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.
@@ -144,7 +148,7 @@ 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=SC3045
+ # shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -152,7 +156,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
- # shellcheck disable=SC3045
+ # shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -197,11 +201,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" \
diff --git a/gradlew.bat b/gradlew.bat
index 93e3f59f..9b42019c 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,92 +1,94 @@
-@rem
-@rem Copyright 2015 the original author or authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem You may obtain a copy of the License at
-@rem
-@rem https://www.apache.org/licenses/LICENSE-2.0
-@rem
-@rem Unless required by applicable law or agreed to in writing, software
-@rem distributed under the License is distributed on an "AS IS" BASIS,
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem See the License for the specific language governing permissions and
-@rem limitations under the License.
-@rem
-
-@if "%DEBUG%"=="" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%"=="" set DIRNAME=.
-@rem This is normally unused
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Resolve any "." and ".." in APP_HOME to make it shorter.
-for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-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.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-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.
-
-goto fail
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
-
-:end
-@rem End local scope for the variables with windows NT shell
-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!
-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
-
-:omega
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+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
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+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
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+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!
+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
+
+:omega
diff --git a/scripts b/scripts
new file mode 160000
index 00000000..6d90cfcd
--- /dev/null
+++ b/scripts
@@ -0,0 +1 @@
+Subproject commit 6d90cfcde1ab669cc1a90fa6f60919b11324fbb1
diff --git a/settings.gradle b/settings.gradle
index 888ce402..203cfd9b 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -7,7 +7,7 @@ pluginManagement {
}
plugins {
- id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
+ id 'org.gradle.toolchains.foojay-resolver-convention' version '0.9.0'
}
-rootProject.name = 'arnicalib'
+rootProject.name = 'ArnicaLib'
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/ArnicaLib.java b/src/main/java/org/auioc/mcmod/arnicalib/ArnicaLib.java
index 8aa4bbde..e64bb3ef 100644
--- a/src/main/java/org/auioc/mcmod/arnicalib/ArnicaLib.java
+++ b/src/main/java/org/auioc/mcmod/arnicalib/ArnicaLib.java
@@ -1,59 +1,57 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib;
-
-import net.minecraft.resources.ResourceLocation;
-import net.neoforged.bus.api.IEventBus;
-import net.neoforged.fml.common.Mod;
-import org.apache.logging.log4j.Logger;
-import org.auioc.mcmod.arnicalib.base.log.LogUtil;
-import org.auioc.mcmod.arnicalib.game.mod.BuildInfo;
-import org.auioc.mcmod.arnicalib.game.mod.IHMod;
-import org.auioc.mcmod.arnicalib.mod.Initialization;
-
-@Mod(ArnicaLib.MOD_ID)
-public final class ArnicaLib implements IHMod {
-
- public static final String MOD_ID = "arnicalib";
- public static final String MOD_NAME = "ArnicaLib";
- public static final Logger LOGGER = LogUtil.getLogger(MOD_NAME);
- public static final BuildInfo BUILD_INFO = BuildInfo.fromPackage(ArnicaLib.class);
-
- private static IEventBus modEventBus;
-
- public ArnicaLib(IEventBus modEventBus) {
- ArnicaLib.modEventBus = modEventBus;
- IHMod.validateVersion(BUILD_INFO, LOGGER);
- Initialization.init();
- }
-
- public static IEventBus getModEventBus() {
- return modEventBus;
- }
-
- public static ResourceLocation id(String path) {
- return new ResourceLocation(MOD_ID, path);
- }
-
- public static String i18n(String key) {
- return MOD_ID + "." + key;
- }
-
-}
+/*
+ * Copyright (C) 2022-2025 AUIOC.ORG
+ *
+ * This file is part of ArnicaLib, a mod made for Minecraft.
+ *
+ * ArnicaLib is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ */
+
+package org.auioc.mcmod.arnicalib;
+
+import net.minecraft.resources.ResourceLocation;
+import net.neoforged.bus.api.IEventBus;
+import net.neoforged.fml.common.Mod;
+import org.auioc.mcmod.arnicalib.game.util.BuildInfo;
+import org.auioc.mcmod.arnicalib.mod.Initialization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
+
+@Mod(ArnicaLib.MOD_ID)
+public final class ArnicaLib {
+
+ public static final String MOD_ID = "arnicalib";
+ public static final String MOD_NAME = "ArnicaLib";
+ public static final Logger LOGGER = LoggerFactory.getLogger(MOD_NAME);
+ public static final Marker MARKER = MarkerFactory.getMarker("CORE");
+ public static final BuildInfo BUILD_INFO = BuildInfo.fromPackage(ArnicaLib.class);
+
+ private static IEventBus modEventBus;
+
+ public ArnicaLib(IEventBus modEventBus) {
+ ArnicaLib.modEventBus = modEventBus;
+ BUILD_INFO.log(LOGGER, MARKER);
+ Initialization.init();
+ }
+
+ public static IEventBus modEventBus() {
+ return modEventBus;
+ }
+
+ public static ResourceLocation id(String path) {
+ return ResourceLocation.fromNamespaceAndPath(MOD_ID, path);
+ }
+
+}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/awt/ImageUtils.java b/src/main/java/org/auioc/mcmod/arnicalib/base/awt/ImageUtils.java
deleted file mode 100644
index 88d0808c..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/awt/ImageUtils.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.awt;
-
-import java.awt.Color;
-import java.awt.Rectangle;
-import java.awt.color.ColorSpace;
-import java.awt.image.BufferedImage;
-
-import org.auioc.mcmod.arnicalib.base.function.BiIntFunction;
-import org.auioc.mcmod.arnicalib.base.validate.Validate;
-
-public class ImageUtils {
-
- public static Color getColor(BufferedImage image, int x, int y) {
- Validate.isTrue(image.getColorModel().getColorSpace().getType() == ColorSpace.TYPE_RGB);
- var pixel = image.getData().getPixel(x, y, new int[4]);
- return new Color(pixel[0], pixel[1], pixel[2], pixel[3]);
- }
-
- public static Color[] getColors(BufferedImage image, int x, int y, int w, int h) {
- int pixelCount = w * h;
- var colors = new Color[pixelCount];
- int i = 0;
- for (int _y = y, y0 = y + h; _y < y0; ++_y) {
- for (int _x = x, x0 = x + w; _x < x0; ++_x) {
- colors[i] = getColor(image, _x, _y);
- i++;
- }
- }
- return colors;
- }
-
- public static Color[] getColors(BufferedImage image, BiIntFunction rectangle) {
- var rect = rectangle.apply(image.getWidth(), image.getHeight());
- return getColors(image, rect.x, rect.y, rect.width, rect.height);
- }
-
- public static int[] getARGBColors(BufferedImage image, BiIntFunction rectangle) {
- var colors = ImageUtils.getColors(image, rectangle);
- var argbColors = new int[colors.length];
- for (int i = 0; i < colors.length; i++) argbColors[i] = colors[i].getRGB();
- return argbColors;
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/cache/Cache.java b/src/main/java/org/auioc/mcmod/arnicalib/base/cache/Cache.java
deleted file mode 100644
index 0f01eda0..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/cache/Cache.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.cache;
-
-public interface Cache {
-
- V get(K key);
-
- void put(K key, V value);
-
- void clear();
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/cache/LoadingCache.java b/src/main/java/org/auioc/mcmod/arnicalib/base/cache/LoadingCache.java
deleted file mode 100644
index 8cd76bd7..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/cache/LoadingCache.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.cache;
-
-import javax.annotation.Nonnull;
-
-public interface LoadingCache extends Cache {
-
- @Nonnull
- V load(K key);
-
- @Override
- default void put(K key, V value) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/cache/PlainCache.java b/src/main/java/org/auioc/mcmod/arnicalib/base/cache/PlainCache.java
deleted file mode 100644
index 7a88e518..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/cache/PlainCache.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.cache;
-
-import java.util.HashMap;
-import java.util.Optional;
-import javax.annotation.Nullable;
-
-public class PlainCache implements Cache {
-
- private final HashMap map = new HashMap();
-
- @Nullable
- @Override
- public V get(K key) {
- return map.get(key);
- }
-
- public Optional getOptional(K key) {
- return Optional.ofNullable(get(key));
- }
-
- @Override
- public void put(K key, V value) {
- map.put(key, value);
- }
-
- @Override
- public void clear() {
- map.clear();
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/cache/PlainLoadingCache.java b/src/main/java/org/auioc/mcmod/arnicalib/base/cache/PlainLoadingCache.java
deleted file mode 100644
index fb3fe755..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/cache/PlainLoadingCache.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.cache;
-
-import java.util.HashMap;
-import java.util.function.Function;
-import javax.annotation.Nonnull;
-
-public class PlainLoadingCache implements LoadingCache {
-
- private final HashMap map = new HashMap();
- private final Function loader;
-
- public PlainLoadingCache(Function loader) {
- this.loader = loader;
- }
-
- @Nonnull
- @Override
- public V get(K key) {
- return (map.containsKey(key)) ? map.get(key) : load(key);
- }
-
- @Nonnull
- @Override
- public V load(K key) {
- V value = loader.apply(key);
- map.put(key, value);
- return value;
- }
-
-
- @Override
- public void clear() {
- map.clear();
- }
-
- public void refresh(K key) {
- load(key);
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/collection/ListUtils.java b/src/main/java/org/auioc/mcmod/arnicalib/base/collection/ListUtils.java
index 0311f97f..4022f3ab 100644
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/collection/ListUtils.java
+++ b/src/main/java/org/auioc/mcmod/arnicalib/base/collection/ListUtils.java
@@ -1,112 +1,108 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.collection;
-
-import org.apache.commons.lang3.Validate;
-
-import java.util.List;
-import java.util.Optional;
-import java.util.function.Predicate;
-import java.util.stream.IntStream;
-
-public class ListUtils {
-
- public static T getLast(List list) {
- Validate.notEmpty(list);
- return list.get(list.size() - 1);
- }
-
- public static Optional getOptional(List list, int index) {
- return (index >= 0 && index < list.size()) ? Optional.ofNullable(list.get(index)) : Optional.empty();
- }
-
- public static T getOrDefault(List list, int index, T defaultValue) {
- return (index >= 0 && index < list.size()) ? list.get(index) : defaultValue;
- }
-
-
- public static int indexOf(List list, Predicate predicate, int ordinal) {
- for (int i = 0, l = list.size(); i < l; ++i) {
- if (predicate.test(list.get(i))) {
- if (ordinal <= 0) return i;
- ordinal--;
- }
- }
- return -1;
- }
-
- public static int indexOf(List list, Predicate predicate) {
- return indexOf(list, predicate, 0);
- }
-
- public static int lastIndexOf(List list, Predicate predicate, int ordinal) {
- for (int i = list.size() - 1; i >= 0; --i) {
- if (predicate.test(list.get(i))) {
- if (ordinal <= 0) return i;
- ordinal--;
- }
- }
- return -1;
- }
-
- public static int lastIndexOf(List list, Predicate predicate) {
- return lastIndexOf(list, predicate, 0);
- }
-
- public static int[] allIndexesOf(List list, Predicate predicate) {
- return IntStream
- .range(0, list.size())
- .filter((i) -> predicate.test(list.get(i)))
- .toArray();
- }
-
-
- public static List findAll(List list, Predicate predicate) {
- return list.stream().filter(predicate).toList();
- }
-
- public static Optional findFirst(List list, Predicate predicate) {
- return list.stream().filter(predicate).findFirst();
- }
-
- public static Optional findFirst(List list, Predicate predicate, int ordinal) {
- return getOptional(list, indexOf(list, predicate, ordinal));
- }
-
- public static Optional findLast(List list, Predicate predicate, int ordinal) {
- return getOptional(list, lastIndexOf(list, predicate, ordinal));
- }
-
-
- public static boolean add(List list, int index, T element) {
- if (index > list.size() || index < 0) return false;
- list.add(index, element);
- return true;
- }
-
- public static boolean addBefore(List list, Predicate refPredicate, T element) {
- return add(list, indexOf(list, refPredicate), element);
- }
-
- public static boolean addAfter(List list, Predicate refPredicate, T element) {
- return add(list, indexOf(list, refPredicate) + 1, element);
- }
-
-}
+/*
+ * Copyright (C) 2022-2025 AUIOC.ORG
+ *
+ * This file is part of ArnicaLib, a mod made for Minecraft.
+ *
+ * ArnicaLib is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ */
+
+package org.auioc.mcmod.arnicalib.base.collection;
+
+import java.util.List;
+import java.util.Optional;
+import java.util.function.Predicate;
+import java.util.stream.IntStream;
+
+public class ListUtils {
+
+ public static Optional getOptional(List list, int index) {
+ return (index >= 0 && index < list.size()) ? Optional.ofNullable(list.get(index)) : Optional.empty();
+ }
+
+ public static T getOrDefault(List list, int index, T defaultValue) {
+ return (index >= 0 && index < list.size()) ? list.get(index) : defaultValue;
+ }
+
+ // ============================================================================================================== //
+
+ public static int indexOf(List list, Predicate predicate, int ordinal) {
+ for (int i = 0, l = list.size(); i < l; ++i) {
+ if (predicate.test(list.get(i))) {
+ if (ordinal <= 0) return i;
+ ordinal--;
+ }
+ }
+ return -1;
+ }
+
+ public static int indexOf(List list, Predicate predicate) {
+ return indexOf(list, predicate, 0);
+ }
+
+ public static int lastIndexOf(List list, Predicate predicate, int ordinal) {
+ for (int i = list.size() - 1; i >= 0; --i) {
+ if (predicate.test(list.get(i))) {
+ if (ordinal <= 0) return i;
+ ordinal--;
+ }
+ }
+ return -1;
+ }
+
+ public static int lastIndexOf(List list, Predicate predicate) {
+ return lastIndexOf(list, predicate, 0);
+ }
+
+ public static int[] allIndexesOf(List list, Predicate predicate) {
+ return IntStream
+ .range(0, list.size())
+ .filter((i) -> predicate.test(list.get(i)))
+ .toArray();
+ }
+
+ // ============================================================================================================== //
+
+ public static List findAll(List list, Predicate predicate) {
+ return list.stream().filter(predicate).toList();
+ }
+
+ public static Optional findFirst(List list, Predicate predicate) {
+ return list.stream().filter(predicate).findFirst();
+ }
+
+ public static Optional findFirst(List list, Predicate predicate, int ordinal) {
+ return getOptional(list, indexOf(list, predicate, ordinal));
+ }
+
+ public static Optional findLast(List list, Predicate predicate, int ordinal) {
+ return getOptional(list, lastIndexOf(list, predicate, ordinal));
+ }
+
+ // ============================================================================================================== //
+
+ public static boolean add(List list, int index, T element) {
+ if (index > list.size() || index < 0) return false;
+ list.add(index, element);
+ return true;
+ }
+
+ public static boolean addBefore(List list, Predicate refPredicate, T element) {
+ return add(list, indexOf(list, refPredicate), element);
+ }
+
+ public static boolean addAfter(List list, Predicate refPredicate, T element) {
+ return add(list, indexOf(list, refPredicate) + 1, element);
+ }
+
+}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/game/entity/projectile/IHProjectile.java b/src/main/java/org/auioc/mcmod/arnicalib/base/event/CancelFlag.java
similarity index 67%
rename from src/main/java/org/auioc/mcmod/arnicalib/game/entity/projectile/IHProjectile.java
rename to src/main/java/org/auioc/mcmod/arnicalib/base/event/CancelFlag.java
index 729778c7..c3632c97 100644
--- a/src/main/java/org/auioc/mcmod/arnicalib/game/entity/projectile/IHProjectile.java
+++ b/src/main/java/org/auioc/mcmod/arnicalib/base/event/CancelFlag.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 AUIOC.ORG
+ * Copyright (C) 2025 AUIOC.ORG
*
* This file is part of ArnicaLib, a mod made for Minecraft.
*
@@ -17,17 +17,25 @@
* this program. If not, see .
*/
-package org.auioc.mcmod.arnicalib.game.entity.projectile;
+package org.auioc.mcmod.arnicalib.base.event;
-import javax.annotation.Nullable;
+/**
+ * @since 7.0.0
+ */
+public class CancelFlag {
+
+ private boolean canceled = false;
-import net.minecraft.world.phys.Vec3;
+ public boolean isCanceled() {
+ return this.canceled;
+ }
-public interface IHProjectile {
+ public void cancel() {
+ this.canceled = true;
+ }
- @Nullable
- default Vec3 getShootingPosition() {
- return null;
+ public void keep() {
+ this.canceled = false;
}
}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/game/server/TpsRecord.java b/src/main/java/org/auioc/mcmod/arnicalib/base/event/EventResult.java
similarity index 81%
rename from src/main/java/org/auioc/mcmod/arnicalib/game/server/TpsRecord.java
rename to src/main/java/org/auioc/mcmod/arnicalib/base/event/EventResult.java
index cd6b9836..35e6be11 100644
--- a/src/main/java/org/auioc/mcmod/arnicalib/game/server/TpsRecord.java
+++ b/src/main/java/org/auioc/mcmod/arnicalib/base/event/EventResult.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 AUIOC.ORG
+ * Copyright (C) 2025 AUIOC.ORG
*
* This file is part of ArnicaLib, a mod made for Minecraft.
*
@@ -17,8 +17,13 @@
* this program. If not, see .
*/
-package org.auioc.mcmod.arnicalib.game.server;
-
-public record TpsRecord(double mspt, double tps) {
+package org.auioc.mcmod.arnicalib.base.event;
+/**
+ * @since 7.0.0
+ */
+public enum EventResult {
+ ALLOW,
+ DEFAULT,
+ DENY;
}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/file/FileUtils.java b/src/main/java/org/auioc/mcmod/arnicalib/base/file/FileUtils.java
deleted file mode 100644
index 8e1007fd..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/file/FileUtils.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.file;
-
-import org.apache.logging.log4j.Marker;
-import org.auioc.mcmod.arnicalib.base.log.LogUtil;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-
-import static org.auioc.mcmod.arnicalib.ArnicaLib.LOGGER;
-
-public class FileUtils extends org.apache.commons.io.FileUtils {
-
- private static final Marker MARKER = LogUtil.getMarker(FileUtils.class);
-
- public static File getOrCreateDirectory(String directoryName) throws IOException {
- var file = new File(directoryName);
-
- if (file.exists()) return file;
-
- if (file.mkdirs()) {
- LOGGER.warn(MARKER, "Directory \"" + file + "\" does not exist, create");
- return file;
- }
- throw new IOException("Could not create directory \"" + file + "\"");
- }
-
- public static File getFile(String fileName) throws IOException {
- var file = new File(fileName);
-
- if (file.getParentFile().exists()) return file;
-
- if (file.getParentFile().mkdirs()) {
- LOGGER.warn(MARKER, "Parent directory of file \"" + file + "\" does not exist, create");
- return file;
- }
- throw new IOException("Could not create parent directory of file \"" + file + "\"");
- }
-
- /**
- * Reads the contents of a file into a String using the UTF-8 charset. The file is always closed.
- *
- * @param file the file to read, must not be {@code null}
- * @return the file contents, never {@code null}
- * @throws NullPointerException if file is {@code null}.
- * @throws FileNotFoundException if the file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.
- * @throws IOException if an I/O error occurs.
- * @see org.apache.commons.io.FileUtils#readFileToString(File, Charset)
- * @since 5.1.4
- */
- public static String readFileToString(final File file) throws IOException {
- return readFileToString(file, StandardCharsets.UTF_8);
- }
-
- /**
- * Writes a String to a file creating the file if it does not exist using the UTF-8 charset.
- *
- * @param file the file to write
- * @param data the content to write to the file
- * @throws IOException in case of an I/O error
- * @see org.apache.commons.io.FileUtils#writeStringToFile(File, String, Charset, boolean)
- * @since 5.1.4
- */
- public static void writeStringToFile(final File file, final String data) throws IOException {
- writeStringToFile(file, data, StandardCharsets.UTF_8, false);
- }
-
- // ====================================================================== //
-
- @Deprecated
- private FileUtils() { }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/file/JarUtils.java b/src/main/java/org/auioc/mcmod/arnicalib/base/file/JarUtils.java
deleted file mode 100644
index eed37c25..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/file/JarUtils.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.file;
-
-import org.apache.logging.log4j.Marker;
-import org.auioc.mcmod.arnicalib.base.log.LogUtil;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-
-import static org.auioc.mcmod.arnicalib.ArnicaLib.LOGGER;
-
-public class JarUtils {
-
- public static final Marker MARKER = LogUtil.getMarker(JarUtils.class);
-
- public static Attributes getManifest(Class> clazz) throws IOException {
- try {
- String path = clazz.getResource(clazz.getSimpleName() + ".class").toString();
- return new Manifest(new URL(path.substring(0, path.lastIndexOf("!") + 1) + "/META-INF/MANIFEST.MF").openStream()).getMainAttributes();
- } catch (Exception e) {
- LOGGER.warn(MARKER, "MANIFEST.MF of " + clazz.getSimpleName() + ".class could not be read. If this is a development environment you can ignore this message.");
- throw e;
- }
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/function/FailableTriPredicate.java b/src/main/java/org/auioc/mcmod/arnicalib/base/function/FailableTriPredicate.java
deleted file mode 100644
index 39f02dab..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/function/FailableTriPredicate.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.function;
-
-import java.util.Objects;
-
-@FunctionalInterface
-public interface FailableTriPredicate {
-
- boolean test(T t, U u, V v) throws E;
-
- default FailableTriPredicate and(FailableTriPredicate super T, ? super U, ? super V, E> other) {
- Objects.requireNonNull(other);
- return (t, u, v) -> test(t, u, v) && other.test(t, u, v);
- }
-
- default FailableTriPredicate negate() {
- return (t, u, v) -> !test(t, u, v);
- }
-
- default FailableTriPredicate or(FailableTriPredicate super T, ? super U, ? super V, E> other) {
- Objects.requireNonNull(other);
- return (t, u, v) -> test(t, u, v) || other.test(t, u, v);
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/function/BiIntFunction.java b/src/main/java/org/auioc/mcmod/arnicalib/base/function/IntToFloatFunction.java
similarity index 85%
rename from src/main/java/org/auioc/mcmod/arnicalib/base/function/BiIntFunction.java
rename to src/main/java/org/auioc/mcmod/arnicalib/base/function/IntToFloatFunction.java
index 75aefdb6..e8f36584 100644
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/function/BiIntFunction.java
+++ b/src/main/java/org/auioc/mcmod/arnicalib/base/function/IntToFloatFunction.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 AUIOC.ORG
+ * Copyright (C) 2025 AUIOC.ORG
*
* This file is part of ArnicaLib, a mod made for Minecraft.
*
@@ -19,9 +19,12 @@
package org.auioc.mcmod.arnicalib.base.function;
+/**
+ * @since 7.0.0
+ */
@FunctionalInterface
-public interface BiIntFunction {
+public interface IntToFloatFunction {
- R apply(int left, int right);
+ float applyAsFloat(int value);
}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/function/QuadConsumer.java b/src/main/java/org/auioc/mcmod/arnicalib/base/function/QuadConsumer.java
deleted file mode 100644
index 2dec0042..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/function/QuadConsumer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.function;
-
-import java.util.Objects;
-
-@FunctionalInterface
-public interface QuadConsumer {
-
- void accept(T t, U u, V v, W w);
-
- default QuadConsumer andThen(QuadConsumer super T, ? super U, ? super V, ? super W> after) {
- Objects.requireNonNull(after);
- return (t, u, v, w) -> {
- accept(t, u, v, w);
- after.accept(t, u, v, w);
- };
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/function/QuadPredicate.java b/src/main/java/org/auioc/mcmod/arnicalib/base/function/QuadPredicate.java
deleted file mode 100644
index 5a4a824e..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/function/QuadPredicate.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.function;
-
-import java.util.Objects;
-
-@FunctionalInterface
-public interface QuadPredicate {
-
- boolean test(T t, U u, V v, W w);
-
- default QuadPredicate negate() {
- return (t, u, v, w) -> !test(t, u, v, w);
- }
-
- default QuadPredicate and(QuadPredicate super T, ? super U, ? super V, ? super W> other) {
- Objects.requireNonNull(other);
- return (t, u, v, w) -> test(t, u, v, w) && other.test(t, u, v, w);
- }
-
- default QuadPredicate or(QuadPredicate super T, ? super U, ? super V, ? super W> other) {
- Objects.requireNonNull(other);
- return (t, u, v, w) -> test(t, u, v, w) || other.test(t, u, v, w);
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/function/StringFunction.java b/src/main/java/org/auioc/mcmod/arnicalib/base/function/StringFunction.java
index 99a178c6..71a72413 100644
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/function/StringFunction.java
+++ b/src/main/java/org/auioc/mcmod/arnicalib/base/function/StringFunction.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 AUIOC.ORG
+ * Copyright (C) 2022-2025 AUIOC.ORG
*
* This file is part of ArnicaLib, a mod made for Minecraft.
*
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/function/StringUnaryOperator.java b/src/main/java/org/auioc/mcmod/arnicalib/base/function/StringUnaryOperator.java
deleted file mode 100644
index 2b808f3c..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/function/StringUnaryOperator.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.function;
-
-import java.util.function.UnaryOperator;
-
-@FunctionalInterface
-public interface StringUnaryOperator extends UnaryOperator {
-
- @Deprecated(since = "6.0.3", forRemoval = true)
- default String applyAsString(String s) {
- return apply(s);
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/function/ThrowableSupplier.java b/src/main/java/org/auioc/mcmod/arnicalib/base/function/ThrowableSupplier.java
deleted file mode 100644
index 3b34a23f..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/function/ThrowableSupplier.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.function;
-
-import java.util.function.Supplier;
-
-@FunctionalInterface
-public interface ThrowableSupplier {
-
- Supplier create(String message);
-
- @FunctionalInterface
- interface Any extends ThrowableSupplier {
- }
-
-
- @FunctionalInterface
- interface Error extends ThrowableSupplier {
- }
-
-
- @FunctionalInterface
- interface Exception extends ThrowableSupplier {
- }
-
-
- @FunctionalInterface
- interface RuntimeException extends ThrowableSupplier {
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/function/ToStringFunction.java b/src/main/java/org/auioc/mcmod/arnicalib/base/function/ToStringFunction.java
index e70d9cf5..ff2816d0 100644
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/function/ToStringFunction.java
+++ b/src/main/java/org/auioc/mcmod/arnicalib/base/function/ToStringFunction.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 AUIOC.ORG
+ * Copyright (C) 2022-2025 AUIOC.ORG
*
* This file is part of ArnicaLib, a mod made for Minecraft.
*
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/function/TriConsumer.java b/src/main/java/org/auioc/mcmod/arnicalib/base/function/TriConsumer.java
deleted file mode 100644
index 5be3444d..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/function/TriConsumer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.function;
-
-import java.util.Objects;
-
-@FunctionalInterface
-public interface TriConsumer {
-
- void accept(T t, U u, V v);
-
- default TriConsumer andThen(TriConsumer super T, ? super U, ? super V> after) {
- Objects.requireNonNull(after);
- return (t, u, v) -> {
- accept(t, u, v);
- after.accept(t, u, v);
- };
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/function/VoidPredicate.java b/src/main/java/org/auioc/mcmod/arnicalib/base/function/VoidPredicate.java
deleted file mode 100644
index 12be202d..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/function/VoidPredicate.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.function;
-
-@FunctionalInterface
-public interface VoidPredicate {
-
- boolean test();
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/holder/IObjectHolder.java b/src/main/java/org/auioc/mcmod/arnicalib/base/holder/IObjectHolder.java
deleted file mode 100644
index 4c2459a2..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/holder/IObjectHolder.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.holder;
-
-public interface IObjectHolder {
-
- T get();
-
- void set(T value);
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/holder/ObjectHolder.java b/src/main/java/org/auioc/mcmod/arnicalib/base/holder/ObjectHolder.java
deleted file mode 100644
index 21c986c9..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/holder/ObjectHolder.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.holder;
-
-public class ObjectHolder implements IObjectHolder {
-
- protected T value;
-
- public ObjectHolder(T value) {
- this.value = value;
- }
-
- @Override
- public T get() {
- return this.value;
- }
-
- @Override
- public void set(T value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return super.toString() + "(" + this.value.toString() + ")";
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/log/LogUtil.java b/src/main/java/org/auioc/mcmod/arnicalib/base/log/LogUtil.java
deleted file mode 100644
index 42b69bbe..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/log/LogUtil.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.log;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.MarkerManager;
-
-public class LogUtil {
-
- private LogUtil() { }
-
- private static StackTraceElement getCaller() {
- StackTraceElement[] callStack = Thread.currentThread().getStackTrace();
-
- StackTraceElement caller = null;
-
- String logClassName = LogUtil.class.getName();
-
- int i = 0;
- for (int len = callStack.length; i < len; i++) {
- if (logClassName.equals(callStack[i].getClassName())) {
- break;
- }
- }
-
- caller = callStack[i + 3];
- return caller;
- }
-
- public static Logger getLoggerByCaller() {
- return LogManager.getLogger(getCaller().getClassName());
- }
-
- public static Logger getLogger(String name) {
- return LogManager.getLogger(name);
- }
-
- public static Marker getMarker(String marker) {
- return MarkerManager.getMarker(marker);
- }
-
- public static Marker getMarker(Class> clazz) {
- return MarkerManager.getMarker(clazz.getSimpleName());
- }
-
-
- public static void trace(Object msg) {
- getLoggerByCaller().trace(msg);
- }
-
- public static void debug(Object msg) {
- getLoggerByCaller().debug(msg);
- }
-
- public static void info(Object msg) {
- getLoggerByCaller().info(msg);
- }
-
- public static void warn(Object msg) {
- getLoggerByCaller().warn(msg);
- }
-
- public static void error(Object msg) {
- getLoggerByCaller().error(msg);
- }
-
- public static void error(Object msg, Throwable t) {
- getLoggerByCaller().error(msg, t);
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/math/MathUtil.java b/src/main/java/org/auioc/mcmod/arnicalib/base/math/MathUtil.java
deleted file mode 100644
index 19d7bff5..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/math/MathUtil.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.math;
-
-import java.util.function.DoubleUnaryOperator;
-import java.util.function.IntUnaryOperator;
-
-public class MathUtil {
-
- public static int sigma(int n, int m, IntUnaryOperator f) {
- int r = 0;
- for (int i = m, _n = n + 1; i < _n; ++i) r += f.applyAsInt(i);
- return r;
- }
-
- public static double sigma(int n, int m, DoubleUnaryOperator f) {
- double r = 0.0D;
- for (int i = m, _n = n + 1; i < _n; ++i) r += f.applyAsDouble((double) i);
- return r;
- }
-
- public static double log(double a, double n) {
- return Math.log(n) / Math.log(a);
- }
-
- public static double log2(double n) {
- return log(2.0D, n);
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/math/MathUtils.java b/src/main/java/org/auioc/mcmod/arnicalib/base/math/MathUtils.java
new file mode 100644
index 00000000..d521c573
--- /dev/null
+++ b/src/main/java/org/auioc/mcmod/arnicalib/base/math/MathUtils.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2022-2025 AUIOC.ORG
+ *
+ * This file is part of ArnicaLib, a mod made for Minecraft.
+ *
+ * ArnicaLib is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ */
+
+package org.auioc.mcmod.arnicalib.base.math;
+
+import org.auioc.mcmod.arnicalib.base.function.IntToFloatFunction;
+
+import java.util.function.IntToDoubleFunction;
+import java.util.function.IntUnaryOperator;
+
+public class MathUtils {
+
+ /**
+ * @param n upper bound of the summation
+ * @param k lower bound of the summation
+ * @param f function to produce each term of the summation, the index is passed as parameter
+ */
+ public static int sigma(int n, int k, IntUnaryOperator f) {
+ int r = 0;
+ for (int i = k, _n = n + 1; i < _n; ++i) r += f.applyAsInt(i);
+ return r;
+ }
+
+ /**
+ * @param n upper bound of the summation
+ * @param k lower bound of the summation
+ * @param f function to produce each term of the summation, the index is passed as parameter
+ */
+ public static double sigma(int n, int k, IntToDoubleFunction f) {
+ double r = 0.0D;
+ for (int i = k, _n = n + 1; i < _n; ++i) r += f.applyAsDouble(i);
+ return r;
+ }
+
+ /**
+ * @param n upper bound of the summation
+ * @param k lower bound of the summation
+ * @param f function to produce each term of the summation, the index is passed as parameter
+ */
+ public static float sigma(int n, int k, IntToFloatFunction f) {
+ float r = 0.0F;
+ for (int i = k, _n = n + 1; i < _n; ++i) r += f.applyAsFloat(i);
+ return r;
+ }
+
+ /**
+ * @param a base
+ * @param n value
+ * @return the base-a logarithm of n
+ */
+ public static double log(double a, double n) {
+ return Math.log(n) / Math.log(a);
+ }
+
+ /**
+ * @param n value
+ * @return the binary logarithm of n
+ */
+ public static double log2(double n) {
+ return log(2.0D, n);
+ }
+
+}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/math/NumberUtils.java b/src/main/java/org/auioc/mcmod/arnicalib/base/math/NumberUtils.java
index bc375c3a..f2b8ba8e 100644
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/math/NumberUtils.java
+++ b/src/main/java/org/auioc/mcmod/arnicalib/base/math/NumberUtils.java
@@ -1,48 +1,49 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.math;
-
-public class NumberUtils extends org.apache.commons.lang3.math.NumberUtils {
-
- public static String toBinaryString(int i, int s) {
- return String.format("0b%" + s + "s", Integer.toBinaryString(i)).replace(" ", "0");
- }
-
- public static String toOctalString(int i, int s) {
- return String.format("0o%" + s + "s", Integer.toOctalString(i)).replace(" ", "0");
- }
-
- public static String toHexString(int i, int s) {
- return String.format("0x%" + s + "s", Integer.toHexString(i)).replace(" ", "0");
- }
-
- public static String toBinaryString(long i, int s) {
- return String.format("0b%" + s + "s", Long.toBinaryString(i)).replace(" ", "0");
- }
-
- public static String toOctalString(long i, int s) {
- return String.format("0o%" + s + "s", Long.toOctalString(i)).replace(" ", "0");
- }
-
- public static String toHexString(long i, int s) {
- return String.format("0x%" + s + "s", Long.toHexString(i)).replace(" ", "0");
- }
-
-}
+/*
+ * Copyright (C) 2022-2025 AUIOC.ORG
+ *
+ * This file is part of ArnicaLib, a mod made for Minecraft.
+ *
+ * ArnicaLib is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ */
+
+package org.auioc.mcmod.arnicalib.base.math;
+
+@SuppressWarnings("deprecation")
+public class NumberUtils extends org.apache.commons.lang3.math.NumberUtils {
+
+ public static String toBinaryString(int i, int s) {
+ return String.format("0b%" + s + "s", Integer.toBinaryString(i)).replace(" ", "0");
+ }
+
+ public static String toOctalString(int i, int s) {
+ return String.format("0o%" + s + "s", Integer.toOctalString(i)).replace(" ", "0");
+ }
+
+ public static String toHexString(int i, int s) {
+ return String.format("0x%" + s + "s", Integer.toHexString(i)).replace(" ", "0");
+ }
+
+ public static String toBinaryString(long i, int s) {
+ return String.format("0b%" + s + "s", Long.toBinaryString(i)).replace(" ", "0");
+ }
+
+ public static String toOctalString(long i, int s) {
+ return String.format("0o%" + s + "s", Long.toOctalString(i)).replace(" ", "0");
+ }
+
+ public static String toHexString(long i, int s) {
+ return String.format("0x%" + s + "s", Long.toHexString(i)).replace(" ", "0");
+ }
+
+}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/math/NumeralUtils.java b/src/main/java/org/auioc/mcmod/arnicalib/base/math/NumeralConverter.java
similarity index 81%
rename from src/main/java/org/auioc/mcmod/arnicalib/base/math/NumeralUtils.java
rename to src/main/java/org/auioc/mcmod/arnicalib/base/math/NumeralConverter.java
index a45a110e..da264ea8 100644
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/math/NumeralUtils.java
+++ b/src/main/java/org/auioc/mcmod/arnicalib/base/math/NumeralConverter.java
@@ -1,144 +1,150 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.math;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class NumeralUtils {
-
- private static final int[] ROMAN_VALUES = {
- /* */ 1000000000,
- 900000000, 500000000, 400000000, 100000000,
- 90000000, 50000000, 40000000, 10000000,
- 9000000, 5000000, 4000000, 1000000,
- 900000, 500000, 400000, 100000,
- 90000, 50000, 40000, 10000,
- 9000, 5000, 4000, 1000,
- 900, 500, 400, 100,
- 90, 50, 40, 10,
- 9, 5, 4, 1
- };
- private static final String[] ROMAN_SYMBOLS = {
- /* */ "M\u033F",
- "C\u033FM\u033F", "D\u033F", "C\u033FD\u033F", "C\u033F",
- "X\u033FC\u033F", "L\u033F", "X\u033FL\u033F", "X\u033F",
- "MX\u033F", "V\u033F", "MV\u033F", "M\u0305",
- "C\u0305M\u0305", "D\u0305", "C\u0305D\u0305", "C\u0305",
- "X\u0305C\u0305", "L\u0305", "X\u0305L\u0305", "X\u0305",
- "MX\u0305", "V\u0305", "MV\u0305", "M",
- "CM", "D", "CD", "C",
- "XC", "L", "XL", "X",
- "IX", "V", "IV", "I"
- };
- private static final String[] ROMAN_SYMBOLS_NO_OVERLINE = {
- /* */ "M:",
- "C:M:", "D:", "C:D:", "C:",
- "X:C:", "L:", "X:L:", "X:",
- "MX:", "V:", "MV:", "M.",
- "C.M.", "D.", "C.D.", "C.",
- "X.C.", "L.", "X.L.", "X.",
- "MX.", "V.", "MV.", "M",
- "CM", "D", "CD", "C",
- "XC", "L", "XL", "X",
- "IX", "V", "IV", "I"
- };
-
- public static String toRoman(int n, boolean noOverline) {
- if (n == 0) return "N";
- n = Math.abs(n);
- var sb = new StringBuilder();
- int i = 0;
- while (i < ROMAN_VALUES.length) {
- while (n >= ROMAN_VALUES[i]) {
- sb.append(noOverline ? ROMAN_SYMBOLS_NO_OVERLINE[i] : ROMAN_SYMBOLS[i]);
- n -= ROMAN_VALUES[i];
- }
- i++;
- }
- return sb.toString();
- }
-
- // ============================================================================================================== //
-
- private static final String[] CHINESE_NUMBERS_SMALL = {"〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"};
- private static final String[] CHINESE_NUMBERS_BIG = {"零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"};
- private static final String[] CHINESE_UNITS_SMALL = {"", "十", "百", "千", "万", "亿"};
- private static final String[] CHINESE_UNITS_BIG = {"", "拾", "佰", "仟", "萬", "億"};
- private static final String CHINESE_NEGATIVE_PREFIX = "负";
-
- private static List toChinese(int n) {
- var a = new ArrayList();
- int i = 0;
- while (n > 0) {
- int s = n % 10000;
- n /= 10000;
- if (i > 0) {
- a.add(i + 10 + 3);
- }
- a.addAll(sectionToChinese(s));
- if (n > 0 && s < 1000) {
- a.add(0);
- }
- i++;
- }
- return a;
- }
-
- private static List sectionToChinese(int n) {
- var a = new ArrayList();
- boolean f = true;
- int i = 0;
- while (n > 0) {
- int v = n % 10;
- n /= 10;
- if (v == 0) {
- if (!f) {
- a.add(v);
- f = true;
- }
- } else {
- a.add(i + 10);
- a.add(v);
- f = false;
- }
- i++;
- }
- return a;
- }
-
- public static String toChinese(int n, boolean big) {
- var sb = new StringBuilder();
- if (n < 0) {
- sb.append(CHINESE_NEGATIVE_PREFIX);
- }
- var a = toChinese(Math.absExact(n));
- for (int i = a.size() - 1; i >= 0; --i) {
- int v = a.get(i);
- if (v > 9) {
- sb.append(big ? CHINESE_UNITS_BIG[v - 10] : CHINESE_UNITS_SMALL[v - 10]);
- } else {
- sb.append(big ? CHINESE_NUMBERS_BIG[v] : CHINESE_NUMBERS_SMALL[v]);
- }
- }
- return sb.toString();
- }
-
-}
+/*
+ * Copyright (C) 2022-2025 AUIOC.ORG
+ *
+ * This file is part of ArnicaLib, a mod made for Minecraft.
+ *
+ * ArnicaLib is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ */
+
+package org.auioc.mcmod.arnicalib.base.math;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author WakelessSloth56
+ * @version 1.0.1
+ * @see Gist: RomanNumberConverter.java
+ * @see Gist: ChineseNumberConverter.java
+ */
+public class NumeralConverter {
+
+ private static final int[] ROMAN_VALUES = {
+ /* */ 1000000000,
+ 900000000, 500000000, 400000000, 100000000,
+ 90000000, 50000000, 40000000, 10000000,
+ 9000000, 5000000, 4000000, 1000000,
+ 900000, 500000, 400000, 100000,
+ 90000, 50000, 40000, 10000,
+ 9000, 5000, 4000, 1000,
+ 900, 500, 400, 100,
+ 90, 50, 40, 10,
+ 9, 5, 4, 1
+ };
+ private static final String[] ROMAN_SYMBOLS = {
+ /* */ "M\u033F",
+ "C\u033FM\u033F", "D\u033F", "C\u033FD\u033F", "C\u033F",
+ "X\u033FC\u033F", "L\u033F", "X\u033FL\u033F", "X\u033F",
+ "MX\u033F", "V\u033F", "MV\u033F", "M\u0305",
+ "C\u0305M\u0305", "D\u0305", "C\u0305D\u0305", "C\u0305",
+ "X\u0305C\u0305", "L\u0305", "X\u0305L\u0305", "X\u0305",
+ "MX\u0305", "V\u0305", "MV\u0305", "M",
+ "CM", "D", "CD", "C",
+ "XC", "L", "XL", "X",
+ "IX", "V", "IV", "I"
+ };
+ private static final String[] ROMAN_SYMBOLS_NO_OVERLINE = {
+ /* */ "M:",
+ "C:M:", "D:", "C:D:", "C:",
+ "X:C:", "L:", "X:L:", "X:",
+ "MX:", "V:", "MV:", "M.",
+ "C.M.", "D.", "C.D.", "C.",
+ "X.C.", "L.", "X.L.", "X.",
+ "MX.", "V.", "MV.", "M",
+ "CM", "D", "CD", "C",
+ "XC", "L", "XL", "X",
+ "IX", "V", "IV", "I"
+ };
+
+ public static String toRoman(int n, boolean noOverline) {
+ if (n == 0) return "N";
+ n = Math.abs(n);
+ var sb = new StringBuilder();
+ int i = 0;
+ while (i < ROMAN_VALUES.length) {
+ while (n >= ROMAN_VALUES[i]) {
+ sb.append(noOverline ? ROMAN_SYMBOLS_NO_OVERLINE[i] : ROMAN_SYMBOLS[i]);
+ n -= ROMAN_VALUES[i];
+ }
+ i++;
+ }
+ return sb.toString();
+ }
+
+ // ============================================================================================================== //
+
+ private static final String[] CHINESE_NUMBERS_SMALL = { "〇", "一", "二", "三", "四", "五", "六", "七", "八", "九" };
+ private static final String[] CHINESE_NUMBERS_BIG = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
+ private static final String[] CHINESE_UNITS_SMALL = { "", "十", "百", "千", "万", "亿" };
+ private static final String[] CHINESE_UNITS_BIG = { "", "拾", "佰", "仟", "萬", "億" };
+ private static final String CHINESE_NEGATIVE_PREFIX = "负";
+
+ private static List toChinese(int n) {
+ var a = new ArrayList();
+ int i = 0;
+ while (n > 0) {
+ int s = n % 10000;
+ n /= 10000;
+ if (i > 0) {
+ a.add(i + 10 + 3);
+ }
+ a.addAll(sectionToChinese(s));
+ if (n > 0 && s < 1000) {
+ a.add(0);
+ }
+ i++;
+ }
+ return a;
+ }
+
+ private static List sectionToChinese(int n) {
+ var a = new ArrayList();
+ boolean f = true;
+ int i = 0;
+ while (n > 0) {
+ int v = n % 10;
+ n /= 10;
+ if (v == 0) {
+ if (!f) {
+ a.add(v);
+ f = true;
+ }
+ } else {
+ a.add(i + 10);
+ a.add(v);
+ f = false;
+ }
+ i++;
+ }
+ return a;
+ }
+
+ public static String toChinese(int n, boolean big) {
+ var sb = new StringBuilder();
+ if (n < 0) {
+ sb.append(CHINESE_NEGATIVE_PREFIX);
+ }
+ var a = toChinese(Math.absExact(n));
+ for (int i = a.size() - 1; i >= 0; --i) {
+ int v = a.get(i);
+ if (v > 9) {
+ sb.append(big ? CHINESE_UNITS_BIG[v - 10] : CHINESE_UNITS_SMALL[v - 10]);
+ } else {
+ sb.append(big ? CHINESE_NUMBERS_BIG[v] : CHINESE_NUMBERS_SMALL[v]);
+ }
+ }
+ return sb.toString();
+ }
+
+}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/holder/LazyObjectHolder.java b/src/main/java/org/auioc/mcmod/arnicalib/base/math/RandomUtils.java
similarity index 53%
rename from src/main/java/org/auioc/mcmod/arnicalib/base/holder/LazyObjectHolder.java
rename to src/main/java/org/auioc/mcmod/arnicalib/base/math/RandomUtils.java
index 3a60b151..0546b9b6 100644
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/holder/LazyObjectHolder.java
+++ b/src/main/java/org/auioc/mcmod/arnicalib/base/math/RandomUtils.java
@@ -1,49 +1,42 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.holder;
-
-import java.util.function.Supplier;
-import javax.annotation.Nullable;
-
-public class LazyObjectHolder implements IObjectHolder {
-
- private final Supplier supplier;
- @Nullable
- private T resolved;
-
- public LazyObjectHolder(Supplier supplier) {
- this.supplier = supplier;
- }
-
- @Override
- @Nullable
- public T get() {
- if (this.resolved == null) {
- this.resolved = this.supplier.get();
- }
- return this.resolved;
- }
-
- @Override
- public void set(T value) {
- throw new UnsupportedOperationException();
- }
-
-}
+/*
+ * Copyright (C) 2024-2025 AUIOC.ORG
+ *
+ * This file is part of ArnicaLib, a mod made for Minecraft.
+ *
+ * ArnicaLib is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ */
+
+package org.auioc.mcmod.arnicalib.base.math;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+public class RandomUtils {
+
+ private static final AtomicLong seedUniquifier = new AtomicLong(9311145141919810L);
+
+ private static long seedUniquifier() {
+ for (; ; ) {
+ long current = seedUniquifier.get();
+ long next = current * 1181783497276652981L;
+ if (seedUniquifier.compareAndSet(current, next)) {
+ return next;
+ }
+ }
+ }
+
+ public static long uniqueSeed() {
+ return seedUniquifier() ^ System.nanoTime();
+ }
+
+}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/network/AddressUtils.java b/src/main/java/org/auioc/mcmod/arnicalib/base/network/AddressUtils.java
deleted file mode 100644
index e1b1d980..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/network/AddressUtils.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.network;
-
-import org.apache.logging.log4j.Marker;
-import org.auioc.mcmod.arnicalib.base.log.LogUtil;
-
-import javax.annotation.Nullable;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-import static org.auioc.mcmod.arnicalib.ArnicaLib.LOGGER;
-
-public interface AddressUtils {
-
- Marker MARKER = LogUtil.getMarker(AddressUtils.class);
-
- @Nullable
- static InetAddress toInetAddress(String addr) {
- try {
- return InetAddress.getByName(addr);
- } catch (UnknownHostException e) {
- LOGGER.error(MARKER, "", e);
- return null;
- }
- }
-
- static boolean isLocalAddress(InetAddress addr) {
- return addr.isLoopbackAddress() || addr.isAnyLocalAddress() || addr.isLinkLocalAddress();
- }
-
- static boolean isLocalAddress(String addr) {
- if (addr.contains("local:E:")) {
- return true;
- }
- return isLocalAddress(toInetAddress(addr));
-
- }
-
- static boolean isLanAddress(InetAddress addr) {
- return addr.isSiteLocalAddress();
- }
-
- static boolean isLanAddress(String addr) {
- if (addr.contains("local:E:")) {
- return true;
- }
- return isLanAddress(toInetAddress(addr));
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/network/HttpUtils.java b/src/main/java/org/auioc/mcmod/arnicalib/base/network/HttpUtils.java
deleted file mode 100644
index 304aae4d..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/network/HttpUtils.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.network;
-
-import java.io.IOException;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.ParseException;
-import org.apache.http.StatusLine;
-import org.apache.http.client.HttpResponseException;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.http.util.EntityUtils;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParser;
-import com.google.gson.JsonSyntaxException;
-
-public interface HttpUtils {
-
- static String get(String url) throws IOException, ParseException {
- String result;
-
- CloseableHttpClient client = HttpClients.createDefault();
- HttpGet httpGet = new HttpGet(url);
- CloseableHttpResponse response = null;
-
- try {
- response = client.execute(httpGet);
- StatusLine statusLine = response.getStatusLine();
-
- if (statusLine.getStatusCode() != 200) {
- throw new HttpResponseException(statusLine.getStatusCode(), statusLine.getReasonPhrase());
- }
- HttpEntity httpEntity = response.getEntity();
- result = EntityUtils.toString(httpEntity);
- } catch (Exception e) {
- throw e;
- } finally {
- try {
- if (response != null) {
- response.close();
- }
- if (client != null) {
- client.close();
- }
- } catch (IOException e) {
- throw e;
- }
- }
-
- return result;
- }
-
- static JsonElement getJson(String url) throws JsonSyntaxException, ParseException, IOException {
- return JsonParser.parseString(get(url));
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/phys/PlaneAlignment.java b/src/main/java/org/auioc/mcmod/arnicalib/base/phys/PlaneAlignment.java
deleted file mode 100644
index 79978902..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/phys/PlaneAlignment.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.phys;
-
-public enum PlaneAlignment {
-
- TOP_LEFT, TOP_CENTER, TOP_RIGHT,
- CENTER_LEFT, CENTER, CENTER_RIGHT,
- BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/phys/Shape.java b/src/main/java/org/auioc/mcmod/arnicalib/base/phys/Shape.java
deleted file mode 100644
index 9570c96b..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/phys/Shape.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.phys;
-
-public enum Shape {
- LINE, //
- POLYGON, CIRCLE, //
- CUBOID, SPHERE, //
-
- START_POLYGON
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/random/RandomUtils.java b/src/main/java/org/auioc/mcmod/arnicalib/base/random/RandomUtils.java
deleted file mode 100644
index 27495991..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/random/RandomUtils.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.random;
-
-import org.auioc.mcmod.arnicalib.base.validate.Validate;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Random;
-import java.util.concurrent.atomic.AtomicLong;
-
-public class RandomUtils {
-
- private static final AtomicLong seedUniquifier = new AtomicLong(9311145141919810L);
-
- private static long seedUniquifier() {
- for (; ; ) {
- long current = seedUniquifier.get();
- long next = current * 1181783497276652981L;
- if (seedUniquifier.compareAndSet(current, next)) {
- return next;
- }
- }
- }
-
- public static long uniqueSeed() {
- return seedUniquifier() ^ System.nanoTime();
- }
-
- // ============================================================================================================== //
-
- public static final Random RANDOM = new Random();
-
- // ============================================================================================================== //
- // #region PickFromCollection
-
- public static T pickOneFromCollection(Collection collection) {
- Validate.notEmpty(collection, "The collection must be not empty");
-
- int size = collection.size();
- int target = RANDOM.nextInt(size);
- Iterator iterator = collection.iterator();
- for (int i = 0; i < target; i++) {
- iterator.next();
- }
- T result = iterator.next();
-
- return result;
- }
-
- public static List pickFromList(List list, int N, boolean allowRepetitions) {
- Validate.notEmpty(list, "The list must be not empty");
-
- int size = list.size();
-
- Validate.isPositive(N, "The number of needed elements must be positive");
- Validate.isTrue(size > N, "The number of needed elements must be smaller or equal to the list size");
-
- if (size == N) {
- return list;
- }
-
- List newList = new ArrayList();
-
- if (N == 1) {
- newList.add(pickOneFromList(list, size));
- } else {
- if (allowRepetitions) {
- for (int i = 0; i < N; i++) {
- newList.add(pickOneFromList(list, size));
- }
- } else {
- List targets = new ArrayList();
- for (int i = 0; i < N; i++) {
- int target;
- while (true) {
- target = RANDOM.nextInt(size);
- if (!targets.contains(target)) {
- targets.add(target);
- break;
- }
- }
- newList.add(list.get(target));
- }
- }
- }
-
- return newList;
- }
-
- public static List pickFromList(List list, int N) {
- return pickFromList(list, N, false);
- }
-
- public static T pickOneFromList(List list) {
- Validate.notEmpty(list, "The list must be not empty");
- return list.get(RANDOM.nextInt(list.size()));
- }
-
- private static T pickOneFromList(List list, int size) {
- return list.get(RANDOM.nextInt(size));
- }
-
- // #endregion PickFromCollection
-
- // ============================================================================================================== //
- // #region Chance
-
- public static boolean percentageChance(int chance) {
- Validate.isInCloseInterval(0, 100, chance);
- return RANDOM.nextInt(100) < chance;
- }
-
- public static boolean percentageChance(int chance, Random random) {
- Validate.isInCloseInterval(0, 100, chance);
- return random.nextInt(100) < chance;
- }
-
- public static boolean fractionChance(int denominator) {
- Validate.isPositive(denominator);
- return RANDOM.nextInt(denominator) == 0;
- }
-
- public static boolean fractionChance(int denominator, Random random) {
- Validate.isPositive(denominator);
- return random.nextInt(denominator) == 0;
- }
-
- public static boolean fractionChance(int numerator, int denominator) {
- Validate.isFractionChance(numerator, denominator);
- return RANDOM.nextInt(denominator) < numerator;
- }
-
- public static boolean fractionChance(int numerator, int denominator, Random random) {
- Validate.isFractionChance(numerator, denominator);
- return random.nextInt(denominator) < numerator;
- }
-
- // #endregion Chance
-
- // ============================================================================================================== //
- // #region Signum
-
- public static int nextSignum() {
- return RANDOM.nextBoolean() ? 1 : -1;
- }
-
- public static int nextSignum(Random random) {
- return random.nextBoolean() ? 1 : -1;
- }
-
- // #endregion Signum
-
- // ============================================================================================================== //
- // #region Offset
-
- public static int offset(int bound, Random random) {
- return random.nextInt(bound) * nextSignum(random);
- }
-
- public static long offset(long bound, Random random) {
- return random.nextLong(bound) * nextSignum(random);
- }
-
- public static float offset(float bound, Random random) {
- return random.nextFloat(bound) * nextSignum(random);
- }
-
- public static double offset(double bound, Random random) {
- return random.nextDouble(bound) * nextSignum(random);
- }
-
- public static int offset(int bound) {
- return RANDOM.nextInt(bound) * nextSignum();
- }
-
- public static long offset(long bound) {
- return RANDOM.nextLong(bound) * nextSignum();
- }
-
- public static float offset(float bound) {
- return RANDOM.nextFloat(bound) * nextSignum();
- }
-
- public static double offset(double bound) {
- return RANDOM.nextDouble(bound) * nextSignum();
- }
-
- // #endregion Offset
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/reflection/ReflectionUtils.java b/src/main/java/org/auioc/mcmod/arnicalib/base/reflection/ReflectionUtils.java
index f29d2906..9dd2f8c2 100644
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/reflection/ReflectionUtils.java
+++ b/src/main/java/org/auioc/mcmod/arnicalib/base/reflection/ReflectionUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022-2024 AUIOC.ORG
+ * Copyright (C) 2023-2025 AUIOC.ORG
*
* This file is part of ArnicaLib, a mod made for Minecraft.
*
@@ -27,6 +27,9 @@
import java.util.Map;
import java.util.Optional;
+/**
+ * @since 5.7.3
+ */
public class ReflectionUtils {
public static Optional getFieldValue(Object object, Field field, Class extends V> type) {
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/word/WordUtils.java b/src/main/java/org/auioc/mcmod/arnicalib/base/text/WordUtils.java
similarity index 90%
rename from src/main/java/org/auioc/mcmod/arnicalib/base/word/WordUtils.java
rename to src/main/java/org/auioc/mcmod/arnicalib/base/text/WordUtils.java
index e18342b0..69353f7a 100644
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/word/WordUtils.java
+++ b/src/main/java/org/auioc/mcmod/arnicalib/base/text/WordUtils.java
@@ -1,35 +1,35 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.word;
-
-import java.util.regex.Pattern;
-
-@SuppressWarnings("deprecation")
-public class WordUtils extends org.apache.commons.lang3.text.WordUtils {
-
- public static String toSnakeCase(String str) {
- return str.replaceAll("[A-Z]", "_$0").toLowerCase();
- }
-
- public static String toCamelCase(String str) {
- return Pattern.compile("_([a-z])").matcher(str).replaceAll(m -> m.group(1).toUpperCase());
- }
-
-}
+/*
+ * Copyright (C) 2022-2025 AUIOC.ORG
+ *
+ * This file is part of ArnicaLib, a mod made for Minecraft.
+ *
+ * ArnicaLib is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ */
+
+package org.auioc.mcmod.arnicalib.base.text;
+
+import java.util.regex.Pattern;
+
+@SuppressWarnings("deprecation")
+public class WordUtils extends org.apache.commons.lang3.text.WordUtils {
+
+ public static String toSnakeCase(String str) {
+ return str.replaceAll("[A-Z]", "_$0").toLowerCase();
+ }
+
+ public static String toCamelCase(String str) {
+ return Pattern.compile("_([a-z])").matcher(str).replaceAll(m -> m.group(1).toUpperCase());
+ }
+
+}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/tuple/IntPair.java b/src/main/java/org/auioc/mcmod/arnicalib/base/tuple/IntPair.java
deleted file mode 100644
index 87002d84..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/tuple/IntPair.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.tuple;
-
-public record IntPair(int x, int y) {
-
- // TODO mutable
-
- @Override
- public String toString() {
- return "(" + x + "," + y + ")";
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) return true;
- if (obj instanceof IntPair other) {
- return (x == other.x()) && (y == other.y());
- }
- return false;
- }
-
- @Override
- public int hashCode() { return (x * 17) + y; }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/tuple/IntTriple.java b/src/main/java/org/auioc/mcmod/arnicalib/base/tuple/IntTriple.java
deleted file mode 100644
index 267d7de8..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/tuple/IntTriple.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.tuple;
-
-public record IntTriple(int x, int y, int z) {
-
- // TODO mutable
-
- @Override
- public String toString() {
- return "(" + x + "," + y + "," + z + ")";
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) return true;
- if (obj instanceof IntTriple other) {
- return (x == other.x()) && (y == other.y()) && (z == other.z());
- }
- return false;
- }
-
- @Override
- public int hashCode() { return (x * 17) + (y * 17) + z; }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/base/validate/Validate.java b/src/main/java/org/auioc/mcmod/arnicalib/base/validate/Validate.java
deleted file mode 100644
index 72706f5a..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/base/validate/Validate.java
+++ /dev/null
@@ -1,436 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.base.validate;
-
-import com.google.common.collect.Range;
-
-public class Validate extends org.apache.commons.lang3.Validate {
-
- // ============================================================================================================== //
- // #region ThrowException
-
- public static void throwException(String message) {
- throw new IllegalArgumentException(message);
- }
-
- public static void throwException(String message, Object... objects) {
- throw new IllegalArgumentException(String.format(message, objects));
- }
-
- // #endregion ThrowException
-
- // ============================================================================================================== //
- // #region CompareToZero
-
- private static final String NOT_POSITIVE_MESSAGE = "The value must be positive: %s";
- private static final String NOT_NEGATIVE_MESSAGE = "The value must be negative: %s";
- private static final String NOT_NON_NEGATIVE_MESSAGE = "The value must be non-negative: %s";
- private static final String NOT_NON_POSITIVE_MESSAGE = "The value must be non-positive: %s";
-
- public static void isPositive(long value, String message) {
- isTrue(value > 0, message);
- }
-
- public static void isNonNegative(long value, String message) {
- isTrue(value >= 0, message);
- }
-
- public static void isNegative(long value, String message) {
- isTrue(value < 0, message);
- }
-
- public static void isNonPositive(long value, String message) {
- isTrue(value <= 0, message);
- }
-
- /*========================================================================*/
-
- public static void isPositive(double value, String message) {
- isTrue(value > 0, message);
- }
-
- public static void isNonNegative(double value, String message) {
- isTrue(value >= 0, message);
- }
-
- public static void isNegative(double value, String message) {
- isTrue(value < 0, message);
- }
-
- public static void isNonPositive(double value, String message) {
- isTrue(value <= 0, message);
- }
-
- /*========================================================================*/
-
- public static void isPositive(long value) {
- isTrue(value > 0, NOT_POSITIVE_MESSAGE, value);
- }
-
- public static void isNonNegative(long value) {
- isTrue(value >= 0, NOT_NON_NEGATIVE_MESSAGE, value);
- }
-
- public static void isNegative(long value) {
- isTrue(value < 0, NOT_NEGATIVE_MESSAGE, value);
- }
-
- public static void isNonPositive(long value) {
- isTrue(value <= 0, NOT_NON_POSITIVE_MESSAGE, value);
- }
-
- /*========================================================================*/
-
- public static void isPositive(double value) {
- isTrue(value > 0, NOT_POSITIVE_MESSAGE, value);
- }
-
- public static void isNonNegative(double value) {
- isTrue(value >= 0, NOT_NON_NEGATIVE_MESSAGE, value);
- }
-
- public static void isNegative(double value) {
- isTrue(value < 0, NOT_NEGATIVE_MESSAGE, value);
- }
-
- public static void isNonPositive(double value) {
- isTrue(value <= 0, NOT_NON_POSITIVE_MESSAGE, value);
- }
-
- // #endregion CompareToZero
-
- // ============================================================================================================== //
- // #region Interval
-
- private static final String INVALID_INTERVAL_MESSAGE = "The left bound must be less than the right bound";
- private static final String NOT_IN_INTERVAL_MESSAGE = "The value %s is not in the interval %s";
- private static final String NOT_IN_OPEN_INTERVAL_MESSAGE = "The value %s is not in the interval (%s, %s)";
- private static final String NOT_IN_CLOSED_INTERVAL_MESSAGE = "The value %s is not in the interval [%s, %s]";
- private static final String NOT_IN_OPEN_CLOSED_INTERVAL_MESSAGE = "The value %s is not in the interval (%s, %s]";
- private static final String NOT_IN_CLOSED_OPEN_INTERVAL_MESSAGE = "The value %s is not in the interval [%s, %s)";
- private static final String NOT_IN_LEFT_OPEN_INTERVAL_MESSAGE = "The value %s is not in the interval (%s, +∞)";
- private static final String NOT_IN_LEFT_CLOSED_INTERVAL_MESSAGE = "The value %s is not in the interval [%s, +∞)";
- private static final String NOT_IN_RIGHT_OPEN_INTERVAL_MESSAGE = "The value %s is not in the interval (-∞, %s)";
- private static final String NOT_IN_RIGHT_CLOSED_INTERVAL_MESSAGE = "The value %s is not in the interval (-∞, %s]";
-
- /**
- * Validate that the specified primitive value is in the specified interval; otherwise, throws an exception.
- *
- * @param interval
- * @param value the value to validate
- * @param message the exception message if invalid
- * @throws IllegalArgumentException if the value is not in the interval
- * @see #isInInterval(Range, double, String)
- */
- public static void isInInterval(Range interval, long value, String message) {
- isTrue(interval.contains(value), message + String.format(NOT_IN_INTERVAL_MESSAGE, value, interval));
- }
-
- /**
- * @see #isInInterval(Range, long, String)
- */
- public static void isInInterval(Range interval, double value, String message) {
- isTrue(interval.contains(value), message + String.format(NOT_IN_INTERVAL_MESSAGE, value, interval));
- }
-
- /*========================================================================*/
-
- /**
- * Validate that the specified bounds are valid the interval bounds; otherwise, throws an exception.
- *
- * @param left the interval left bound
- * @param right the interval right bound
- */
- public static void isBoundedInterval(long left, long right) {
- isTrue(left < right, INVALID_INTERVAL_MESSAGE);
- }
-
-
- /**
- * @see #isBoundedInterval(long, long)
- */
- public static void isBoundedInterval(double left, double right) {
- isTrue(left < right, INVALID_INTERVAL_MESSAGE);
- }
-
-
- /*========================================================================*/
-
- /**
- * Validate that the specified primitive value is in the interval (left, right); otherwise, throws an exception.
- *
- * @param left the interval left bound
- * @param right the interval right bound
- * @param value the value to validate
- * @throws IllegalArgumentException if the value is not in the interval
- * @see #isInOpenInterval(double, double, double)
- */
- public static void isInOpenInterval(long left, long right, long value) {
- isBoundedInterval(left, right);
- isTrue(value > left && value < right, NOT_IN_OPEN_INTERVAL_MESSAGE, value, left, right);
- }
-
- /**
- * Validate that the specified primitive value is in the interval [left, right]; otherwise, throws an exception.
- *
- * @param left the interval left bound
- * @param right the interval right bound
- * @param value the value to validate
- * @throws IllegalArgumentException if the value is not in the interval
- * @see #isInCloseInterval(double, double, double)
- */
- public static void isInCloseInterval(long left, long right, long value) {
- isBoundedInterval(left, right);
- isTrue(value >= left && value <= right, NOT_IN_CLOSED_INTERVAL_MESSAGE, value, left, right);
- }
-
- /**
- * Validate that the specified primitive value is in the interval (left, right]; otherwise, throws an exception.
- *
- * @param left the interval left bound
- * @param right the interval right bound
- * @param value the value to validate
- * @throws IllegalArgumentException if the value is not in the interval
- * @see #isInOpenCloseInterval(double, double, double)
- */
- public static void isInOpenCloseInterval(long left, long right, long value) {
- isBoundedInterval(left, right);
- isTrue(value > left && value <= right, NOT_IN_OPEN_CLOSED_INTERVAL_MESSAGE, value, left, right);
- }
-
- /**
- * Validate that the specified primitive value is in the interval [left, right); otherwise, throws an exception.
- *
- * @param left the interval left bound
- * @param right the interval right bound
- * @param value the value to validate
- * @throws IllegalArgumentException if the value is not in the interval
- * @see #isInCloseOpenInterval(double, double, double)
- */
- public static void isInCloseOpenInterval(long left, long right, long value) {
- isBoundedInterval(left, right);
- isTrue(value >= left && value < right, NOT_IN_CLOSED_OPEN_INTERVAL_MESSAGE, value, left, right);
- }
-
- /**
- * Validate that the specified primitive value is in the interval (left, +∞); otherwise, throws an exception.
- *
- * @param left the interval left bound
- * @param value the value to validate
- * @throws IllegalArgumentException if the value is not in the interval
- * @see #isInLeftOpenInterval(double, double)
- */
- public static void isInLeftOpenInterval(long left, long value) {
- isTrue(value > left, NOT_IN_LEFT_OPEN_INTERVAL_MESSAGE, value, left);
- }
-
- /**
- * Validate that the specified primitive value is in the interval [left, +∞); otherwise, throws an exception.
- *
- * @param left the interval left bound
- * @param value the value to validate
- * @throws IllegalArgumentException if the value is not in the interval
- * @see #isInLeftClosedInterval(double, double)
- */
- public static void isInLeftClosedInterval(long left, long value) {
- isTrue(value >= left, NOT_IN_LEFT_CLOSED_INTERVAL_MESSAGE, value, left);
- }
-
- /**
- * Validate that the specified primitive value is in the interval (-∞, right); otherwise, throws an exception.
- *
- * @param right the interval left bound
- * @param value the value to validate
- * @throws IllegalArgumentException if the value is not in the interval
- * @see #isInRightOpenInterval(double, double)
- */
- public static void isInRightOpenInterval(long right, long value) {
- isTrue(value < right, NOT_IN_RIGHT_OPEN_INTERVAL_MESSAGE, value, right);
- }
-
- /**
- * Validate that the specified primitive value is in the interval (-∞, right]; otherwise, throws an exception.
- *
- * @param right the interval left bound
- * @param value the value to validate
- * @throws IllegalArgumentException if the value is not in the interval
- * @see #isInRightClosedInterval(double, double)
- */
- public static void isInRightClosedInterval(long right, long value) {
- isTrue(value <= right, NOT_IN_RIGHT_CLOSED_INTERVAL_MESSAGE, value, right);
- }
-
- /**
- * Validate that the specified primitive value is in the interval (right, left); it always throws an exception.
- *
- * @param left the interval left bound
- * @param right the interval right bound
- * @param value the value to validate
- * @throws IllegalArgumentException if the value is not in the interval
- * @see #isInEmptyInterval(double, double, double)
- */
- public static void isInEmptyInterval(long left, long right, long value) {
- isBoundedInterval(left, right);
- isTrue(false, NOT_IN_OPEN_INTERVAL_MESSAGE, value, right, left);
- }
-
- /**
- * Validate that the specified primitive value is in the interval [bound, bound]; otherwise, throws an exception.
- *
- * @param bound the interval bound
- * @param value the value to validate
- * @throws IllegalArgumentException if the value is not in the interval
- * @see #isInDegenerateInterval(double, double)
- */
- public static void isInDegenerateInterval(long bound, long value) {
- isTrue(value == bound, NOT_IN_CLOSED_INTERVAL_MESSAGE, value, bound, bound);
- }
-
-
- /**
- * Validate that the specified primitive value is in the interval (-∞, +∞); it never throws an exception.
- *
- * @param value the value to validate
- * @see #isInUnboundedInterval(double)
- */
- public static void isInUnboundedInterval(long value) { }
-
- /*========================================================================*/
-
- /**
- * @see #isInOpenInterval(long, long, long)
- */
- public static void isInOpenInterval(double left, double right, double value) {
- isBoundedInterval(left, right);
- isTrue(value > left && value < right, NOT_IN_OPEN_INTERVAL_MESSAGE, value, left, right);
- }
-
- /**
- * @see #isInCloseInterval(long, long, long)
- */
- public static void isInCloseInterval(double left, double right, double value) {
- isBoundedInterval(left, right);
- isTrue(value >= left && value <= right, NOT_IN_CLOSED_INTERVAL_MESSAGE, value, left, right);
- }
-
- /**
- * @see #isInOpenCloseInterval(long, long, long)
- */
- public static void isInOpenCloseInterval(double left, double right, double value) {
- isBoundedInterval(left, right);
- isTrue(value > left && value <= right, NOT_IN_OPEN_CLOSED_INTERVAL_MESSAGE, value, left, right);
- }
-
- /**
- * @see #isInCloseOpenInterval(long, long, long)
- */
- public static void isInCloseOpenInterval(double left, double right, double value) {
- isBoundedInterval(left, right);
- isTrue(value >= left && value < right, NOT_IN_CLOSED_OPEN_INTERVAL_MESSAGE, value, left, right);
- }
-
- /**
- * @see #isInLeftOpenInterval(long, long)
- */
- public static void isInLeftOpenInterval(double left, double value) {
- isTrue(value > left, NOT_IN_LEFT_OPEN_INTERVAL_MESSAGE, value, left);
- }
-
- /**
- * @see #isInLeftClosedInterval(long, long)
- */
- public static void isInLeftClosedInterval(double left, double value) {
- isTrue(value >= left, NOT_IN_LEFT_CLOSED_INTERVAL_MESSAGE, value, left);
- }
-
- /**
- * @see #isInRightOpenInterval(long, long)
- */
- public static void isInRightOpenInterval(double right, double value) {
- isTrue(value < right, NOT_IN_RIGHT_OPEN_INTERVAL_MESSAGE, value, right);
- }
-
- /**
- * @see #isInRightClosedInterval(long, long)
- */
- public static void isInRightClosedInterval(double right, double value) {
- isTrue(value <= right, NOT_IN_RIGHT_CLOSED_INTERVAL_MESSAGE, value, right);
- }
-
- /**
- * @see #isInEmptyInterval(long, long, long)
- */
- public static void isInEmptyInterval(double left, double right, double value) {
- isBoundedInterval(left, right);
- isTrue(false, NOT_IN_OPEN_INTERVAL_MESSAGE, value, right, left);
- }
-
- /**
- * @see #isInDegenerateInterval(long, long)
- */
- public static void isInDegenerateInterval(double bound, double value) {
- isTrue(value == bound, NOT_IN_CLOSED_INTERVAL_MESSAGE, value, bound, bound);
- }
-
-
- /**
- * @see #isInUnboundedInterval(long)
- */
- public static void isInUnboundedInterval(double value) { }
-
- // #endregion Interval
-
- // ============================================================================================================== //
- // #region Fraction
-
- private static final String INVALID_FRACTION_MESSAGE = "The denominator must not be zero";
- private static final String NOT_A_PROPER_FRACTION_MESSAGE = "%s/%s is not a proper fraction";
- private static final String NOT_A_IMPROPER_FRACTION_MESSAGE = "%s/%s is not a improper fraction";
- private static final String NOT_A_UNIT_FRACTION_MESSAGE = "%s/%s is not a unit fraction";
- private static final String INVALID_FRACTION_CHANCE = "%s/%s is not a valid fraction chance value";
-
- public static void isFraction(long numerator, long denominator) {
- isTrue(denominator != 0, INVALID_FRACTION_MESSAGE);
- }
-
- public static void isProperFraction(long numerator, long denominator) {
- isFraction(numerator, denominator);
- isTrue(numerator > 0 && denominator > 0, NOT_A_PROPER_FRACTION_MESSAGE, numerator, denominator);
- isTrue(numerator < denominator, NOT_A_PROPER_FRACTION_MESSAGE, numerator, denominator);
- }
-
- public static void isImproperFraction(long numerator, long denominator) {
- isFraction(numerator, denominator);
- isTrue(Math.abs(numerator / denominator) >= 1, NOT_A_IMPROPER_FRACTION_MESSAGE, numerator, denominator);
- }
-
- public static void isUnitFraction(long numerator, long denominator) {
- isProperFraction(numerator, denominator);
- isTrue(numerator == 1, NOT_A_UNIT_FRACTION_MESSAGE, numerator, denominator);
- }
-
- public static void isFractionChance(long numerator, long denominator) {
- isFraction(numerator, denominator);
- isTrue(numerator >= 0 && denominator > 0 && numerator <= denominator, INVALID_FRACTION_CHANCE, numerator, denominator);
- }
-
- // #endregion ProperFraction
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/game/advancement/DisplayInfoBuilder.java b/src/main/java/org/auioc/mcmod/arnicalib/game/advancement/DisplayInfoBuilder.java
index ff52e07a..fe2678a8 100644
--- a/src/main/java/org/auioc/mcmod/arnicalib/game/advancement/DisplayInfoBuilder.java
+++ b/src/main/java/org/auioc/mcmod/arnicalib/game/advancement/DisplayInfoBuilder.java
@@ -1,131 +1,132 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.game.advancement;
-
-import net.minecraft.advancements.AdvancementType;
-import net.minecraft.advancements.DisplayInfo;
-import net.minecraft.network.chat.Component;
-import net.minecraft.resources.ResourceLocation;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.ItemLike;
-
-import javax.annotation.Nullable;
-import java.util.Optional;
-
-public class DisplayInfoBuilder {
-
- private Component title = Component.literal("advancement");
- private Component description = Component.literal("advancement.description");
- private ItemStack icon = ItemStack.EMPTY;
- @Nullable
- private ResourceLocation background = null;
- private AdvancementType frame = AdvancementType.TASK;
- private boolean showToast = false;
- private boolean announceChat = false;
- private boolean hidden = false;
-
- public DisplayInfoBuilder() { }
-
- public DisplayInfo build() {
- return new DisplayInfo(icon, title, description, Optional.ofNullable(background), frame, showToast, hidden, announceChat);
- }
-
- public DisplayInfoBuilder title(Component title) {
- this.title = title;
- return this;
- }
-
- public DisplayInfoBuilder title(String key) {
- title(Component.translatable(key));
- return this;
- }
-
- public DisplayInfoBuilder description(Component description) {
- this.description = description;
- return this;
- }
-
- public DisplayInfoBuilder description(String key) {
- description(Component.translatable(key));
- return this;
- }
-
- public DisplayInfoBuilder titleAndDescription(String key) {
- title(key);
- description(key + ".description");
- return this;
- }
-
- public DisplayInfoBuilder icon(ItemStack icon) {
- this.icon = icon;
- return this;
- }
-
- public DisplayInfoBuilder icon(ItemLike icon) {
- icon(new ItemStack(icon.asItem()));
- return this;
- }
-
- public DisplayInfoBuilder background(ResourceLocation background) {
- this.background = background;
- return this;
- }
-
- public DisplayInfoBuilder background(String background) {
- background(new ResourceLocation(background));
- return this;
- }
-
- public DisplayInfoBuilder frame(AdvancementType frame) {
- this.frame = frame;
- return this;
- }
-
- public DisplayInfoBuilder taskFrame() {
- frame(AdvancementType.TASK);
- return this;
- }
-
- public DisplayInfoBuilder challengeFrame() {
- frame(AdvancementType.CHALLENGE);
- return this;
- }
-
- public DisplayInfoBuilder goalFrame() {
- frame(AdvancementType.GOAL);
- return this;
- }
-
- public DisplayInfoBuilder showToast() {
- this.showToast = true;
- return this;
- }
-
- public DisplayInfoBuilder announceChat() {
- this.announceChat = true;
- return this;
- }
-
- public DisplayInfoBuilder hidden() {
- this.hidden = true;
- return this;
- }
-
-}
+/*
+ * Copyright (C) 2022-2025 AUIOC.ORG
+ *
+ * This file is part of ArnicaLib, a mod made for Minecraft.
+ *
+ * ArnicaLib is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ */
+
+package org.auioc.mcmod.arnicalib.game.advancement;
+
+
+import net.minecraft.advancements.AdvancementType;
+import net.minecraft.advancements.DisplayInfo;
+import net.minecraft.network.chat.Component;
+import net.minecraft.resources.ResourceLocation;
+import net.minecraft.world.item.ItemStack;
+import net.minecraft.world.level.ItemLike;
+
+import javax.annotation.Nullable;
+import java.util.Optional;
+
+public class DisplayInfoBuilder {
+
+ private Component title = Component.literal("advancement");
+ private Component description = Component.literal("advancement.description");
+ private ItemStack icon = ItemStack.EMPTY;
+ @Nullable
+ private ResourceLocation background = null;
+ private AdvancementType frame = AdvancementType.TASK;
+ private boolean showToast = false;
+ private boolean announceChat = false;
+ private boolean hidden = false;
+
+ public DisplayInfoBuilder() { }
+
+ public DisplayInfo build() {
+ return new DisplayInfo(icon, title, description, Optional.ofNullable(background), frame, showToast, hidden, announceChat);
+ }
+
+ public DisplayInfoBuilder title(Component title) {
+ this.title = title;
+ return this;
+ }
+
+ public DisplayInfoBuilder title(String key) {
+ title(Component.translatable(key));
+ return this;
+ }
+
+ public DisplayInfoBuilder description(Component description) {
+ this.description = description;
+ return this;
+ }
+
+ public DisplayInfoBuilder description(String key) {
+ description(Component.translatable(key));
+ return this;
+ }
+
+ public DisplayInfoBuilder titleAndDescription(String key) {
+ title(key);
+ description(key + ".description");
+ return this;
+ }
+
+ public DisplayInfoBuilder icon(ItemStack icon) {
+ this.icon = icon;
+ return this;
+ }
+
+ public DisplayInfoBuilder icon(ItemLike icon) {
+ icon(new ItemStack(icon.asItem()));
+ return this;
+ }
+
+ public DisplayInfoBuilder background(ResourceLocation background) {
+ this.background = background;
+ return this;
+ }
+
+ public DisplayInfoBuilder background(String background) {
+ background(ResourceLocation.parse(background));
+ return this;
+ }
+
+ public DisplayInfoBuilder frame(AdvancementType frame) {
+ this.frame = frame;
+ return this;
+ }
+
+ public DisplayInfoBuilder taskFrame() {
+ frame(AdvancementType.TASK);
+ return this;
+ }
+
+ public DisplayInfoBuilder challengeFrame() {
+ frame(AdvancementType.CHALLENGE);
+ return this;
+ }
+
+ public DisplayInfoBuilder goalFrame() {
+ frame(AdvancementType.GOAL);
+ return this;
+ }
+
+ public DisplayInfoBuilder showToast() {
+ this.showToast = true;
+ return this;
+ }
+
+ public DisplayInfoBuilder announceChat() {
+ this.announceChat = true;
+ return this;
+ }
+
+ public DisplayInfoBuilder hidden() {
+ this.hidden = true;
+ return this;
+ }
+
+}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/game/block/BlockUtils.java b/src/main/java/org/auioc/mcmod/arnicalib/game/block/BlockUtils.java
deleted file mode 100644
index e39b56d3..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/game/block/BlockUtils.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.game.block;
-
-import net.minecraft.world.level.block.state.BlockState;
-
-public class BlockUtils {
-
- @SuppressWarnings("deprecation")
- public static boolean canStandOn(BlockState blockStats) {
- return blockStats.blocksMotion();
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/game/chat/MessageHelper.java b/src/main/java/org/auioc/mcmod/arnicalib/game/chat/MessageHelper.java
deleted file mode 100644
index 1cda7339..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/game/chat/MessageHelper.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.game.chat;
-
-import org.auioc.mcmod.arnicalib.base.function.StringUnaryOperator;
-import net.minecraft.ChatFormatting;
-import net.minecraft.network.chat.Component;
-import net.minecraft.network.chat.MutableComponent;
-
-public class MessageHelper {
-
- private final Component prefix;
- private final StringUnaryOperator i18n;
-
- public MessageHelper(Component prefix, StringUnaryOperator i18n) {
- this.prefix = prefix;
- this.i18n = i18n;
- }
-
- public MessageHelper(String modName, StringUnaryOperator i18n) {
- this(Component.literal("[" + modName + "] ").withStyle(ChatFormatting.AQUA), i18n);
- }
-
-
- public MessageHelper(StringUnaryOperator i18n) {
- this(Component.empty(), i18n);
- }
-
-
- public MutableComponent create(Component message, boolean withPrefix) {
- return withPrefix ? (Component.empty()).append(this.prefix).append(message) : (Component.empty()).append(message);
- }
-
- public MutableComponent create(String key, Object[] args, boolean withPrefix) {
- return create(Component.translatable(this.i18n.apply(key), args), withPrefix);
- }
-
- public MutableComponent create(String key, boolean withPrefix) {
- return create(key, TextUtils.NO_ARGS, withPrefix);
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/game/chat/TextUtils.java b/src/main/java/org/auioc/mcmod/arnicalib/game/chat/TextUtils.java
deleted file mode 100644
index 568e5529..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/game/chat/TextUtils.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.game.chat;
-
-import com.google.gson.JsonElement;
-import com.mojang.serialization.Dynamic;
-import com.mojang.serialization.JsonOps;
-import net.minecraft.network.chat.*;
-import org.apache.logging.log4j.Marker;
-import org.auioc.mcmod.arnicalib.base.log.LogUtil;
-
-import javax.annotation.Nullable;
-import java.util.List;
-
-import static org.auioc.mcmod.arnicalib.ArnicaLib.LOGGER;
-
-public class TextUtils {
-
- private static final Marker MARKER = LogUtil.getMarker(TextUtils.class);
-
- public static final Object[] NO_ARGS = new Object[0];
-
- /**
- * @deprecated Use {@link net.minecraft.network.chat.Component#empty()} instead
- */
- @Deprecated(since = "6.0.0", forRemoval = true)
- public static MutableComponent empty() {
- return Component.empty();
-
- }
-
- /**
- * @deprecated Use {@link net.minecraft.network.chat.Component#literal(String)} instead
- */
- @Deprecated(since = "6.0.0", forRemoval = true)
- public static MutableComponent literal(String text) {
- return Component.literal(text);
- }
-
- /**
- * @deprecated Use {@link net.minecraft.network.chat.Component#translatable(String)} instead
- */
- @Deprecated(since = "6.0.0", forRemoval = true)
- public static MutableComponent translatable(String key) {
- return Component.translatable(key);
- }
-
- /**
- * @deprecated Use {@link net.minecraft.network.chat.Component#translatable(String, Object...)} instead
- */
- @Deprecated(since = "6.0.0", forRemoval = true)
- public static MutableComponent translatable(String key, Object... arguments) {
- return Component.translatable(key, arguments);
- }
-
-
- public static Style copyable(Style style, String c) {
- return style.withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, c)).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, translatable("chat.copy.click")));
- }
-
- public static MutableComponent copyable(Component c) {
- return TextUtils.empty().append(c).withStyle((s) -> copyable(s, c.getString()));
- }
-
- public static MutableComponent copyable(String c) {
- return copyable(TextUtils.literal(c));
- }
-
-
- public static MutableComponent join(List texts, Component separator) {
- var r = empty();
- if (texts.isEmpty()) return r;
-
- int s = texts.size();
- for (int i = 0, l = s - 1; i < l; ++i) {
- r.append(texts.get(i)).append(separator);
- }
- r.append(texts.get(s - 1));
-
- return r;
- }
-
- public static MutableComponent join(List texts) {
- return join(texts, literal(", "));
- }
-
- @Nullable
- public static Style deserializeStyle(JsonElement json) {
- return Style.Serializer.CODEC
- .parse(new Dynamic<>(JsonOps.INSTANCE, json))
- .getOrThrow(false, (error) -> LOGGER.error(MARKER, error));
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/game/codec/EnumCodec.java b/src/main/java/org/auioc/mcmod/arnicalib/game/codec/EnumCodec.java
index a59f8162..8ed10ad4 100644
--- a/src/main/java/org/auioc/mcmod/arnicalib/game/codec/EnumCodec.java
+++ b/src/main/java/org/auioc/mcmod/arnicalib/game/codec/EnumCodec.java
@@ -1,105 +1,106 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.game.codec;
-
-import com.mojang.datafixers.util.Pair;
-import com.mojang.serialization.Codec;
-import com.mojang.serialization.DataResult;
-import com.mojang.serialization.DynamicOps;
-import net.minecraft.util.ExtraCodecs;
-import org.auioc.mcmod.arnicalib.base.function.StringFunction;
-import org.auioc.mcmod.arnicalib.base.function.ToStringFunction;
-
-import java.util.Arrays;
-import java.util.function.IntFunction;
-import java.util.stream.Collectors;
-
-public class EnumCodec> implements Codec {
-
- private final Codec codec;
-
- private EnumCodec(Codec codec) {
- this.codec = codec;
- }
-
- @Override
- public DataResult encode(E input, DynamicOps ops, T prefix) {
- return this.codec.encode(input, ops, prefix);
- }
-
- @Override
- public DataResult> decode(DynamicOps ops, T input) {
- return this.codec.decode(ops, input);
- }
-
- // ============================================================================================================== //
-
- private static > EnumCodec of(IntFunction decoder) {
- return new EnumCodec<>(ExtraCodecs.idResolverCodec(Enum::ordinal, decoder, -1));
- }
-
- private static > EnumCodec of(ToStringFunction encoder, StringFunction decoder) {
- return new EnumCodec<>(ExtraCodecs.stringResolverCodec(encoder, (s) -> (s != null) ? decoder.apply(s) : null));
- }
-
- private static > EnumCodec of(E[] values, ToStringFunction encoder, int threshold) {
- if (values.length > threshold) {
- var map = Arrays.stream(values)
- .collect(Collectors.toMap(encoder, (e) -> e));
- return of(encoder, map::get);
- }
- return of(encoder, (s) -> {
- for (E e : values) if (encoder.apply(e).equals(s)) return e;
- return null;
- });
- }
-
- private static final int THRESHOLD = 8;
-
- // ====================================================================== //
-
- public static > EnumCodec byString(Class enumClass, ToStringFunction encoder, int threshold) {
- return of(enumClass.getEnumConstants(), encoder, threshold);
- }
-
- public static > EnumCodec byString(Class enumClass, ToStringFunction encoder) {
- return byString(enumClass, encoder, THRESHOLD);
- }
-
- public static > EnumCodec byName(Class enumClass) {
- return byString(enumClass, E::name, THRESHOLD);
- }
-
- public static > EnumCodec byNameLowerCase(Class enumClass) {
- return byString(enumClass, (e) -> e.name().toLowerCase(), THRESHOLD);
- }
-
- public static > EnumCodec byNameUpperCase(Class enumClass) {
- return byString(enumClass, (e) -> e.name().toUpperCase(), THRESHOLD);
- }
-
- // ====================================================================== //
-
- public static > EnumCodec byOrdinal(Class enumClass) {
- var values = enumClass.getEnumConstants();
- return of((i) -> (i >= 0 && i < values.length) ? values[i] : null);
- }
-
-}
+/*
+ * Copyright (C) 2024-2025 AUIOC.ORG
+ *
+ * This file is part of ArnicaLib, a mod made for Minecraft.
+ *
+ * ArnicaLib is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ */
+
+package org.auioc.mcmod.arnicalib.game.codec;
+
+
+import com.mojang.datafixers.util.Pair;
+import com.mojang.serialization.Codec;
+import com.mojang.serialization.DataResult;
+import com.mojang.serialization.DynamicOps;
+import net.minecraft.util.ExtraCodecs;
+import org.auioc.mcmod.arnicalib.base.function.StringFunction;
+import org.auioc.mcmod.arnicalib.base.function.ToStringFunction;
+
+import java.util.Arrays;
+import java.util.function.IntFunction;
+import java.util.stream.Collectors;
+
+public class EnumCodec> implements Codec {
+
+ private final Codec codec;
+
+ private EnumCodec(Codec codec) {
+ this.codec = codec;
+ }
+
+ @Override
+ public DataResult encode(E input, DynamicOps ops, T prefix) {
+ return this.codec.encode(input, ops, prefix);
+ }
+
+ @Override
+ public DataResult> decode(DynamicOps ops, T input) {
+ return this.codec.decode(ops, input);
+ }
+
+ // ============================================================================================================== //
+
+ private static > EnumCodec of(IntFunction decoder) {
+ return new EnumCodec<>(ExtraCodecs.idResolverCodec(Enum::ordinal, decoder, -1));
+ }
+
+ private static > EnumCodec of(ToStringFunction encoder, StringFunction decoder) {
+ return new EnumCodec<>(Codec.stringResolver(encoder, (s) -> (s != null) ? decoder.apply(s) : null));
+ }
+
+ private static > EnumCodec of(E[] values, ToStringFunction encoder, int threshold) {
+ if (values.length > threshold) {
+ var map = Arrays.stream(values)
+ .collect(Collectors.toMap(encoder, (e) -> e));
+ return of(encoder, map::get);
+ }
+ return of(encoder, (s) -> {
+ for (E e : values) if (encoder.apply(e).equals(s)) return e;
+ return null;
+ });
+ }
+
+ private static final int THRESHOLD = 8;
+
+ // ====================================================================== //
+
+ public static > EnumCodec byString(Class enumClass, ToStringFunction encoder, int threshold) {
+ return of(enumClass.getEnumConstants(), encoder, threshold);
+ }
+
+ public static > EnumCodec byString(Class enumClass, ToStringFunction encoder) {
+ return byString(enumClass, encoder, THRESHOLD);
+ }
+
+ public static > EnumCodec byName(Class enumClass) {
+ return byString(enumClass, E::name, THRESHOLD);
+ }
+
+ public static > EnumCodec byNameLowerCase(Class enumClass) {
+ return byString(enumClass, (e) -> e.name().toLowerCase(), THRESHOLD);
+ }
+
+ public static > EnumCodec byNameUpperCase(Class enumClass) {
+ return byString(enumClass, (e) -> e.name().toUpperCase(), THRESHOLD);
+ }
+
+ // ====================================================================== //
+
+ public static > EnumCodec byOrdinal(Class enumClass) {
+ var values = enumClass.getEnumConstants();
+ return of((i) -> (i >= 0 && i < values.length) ? values[i] : null);
+ }
+
+}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/game/command/AHCommands.java b/src/main/java/org/auioc/mcmod/arnicalib/game/command/AHCommands.java
deleted file mode 100644
index af7a9851..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/game/command/AHCommands.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.game.command;
-
-import com.mojang.brigadier.CommandDispatcher;
-import com.mojang.brigadier.tree.CommandNode;
-import net.minecraft.commands.CommandSourceStack;
-import net.neoforged.api.distmarker.Dist;
-import net.neoforged.api.distmarker.OnlyIn;
-import org.auioc.mcmod.arnicalib.mod.client.command.AHClientCommands;
-import org.auioc.mcmod.arnicalib.mod.server.command.AHServerCommands;
-
-public final class AHCommands {
-
- public static CommandNode getServerNode(CommandDispatcher dispatcher) {
- return AHServerCommands.getAHNode(dispatcher);
- }
-
- @OnlyIn(Dist.CLIENT)
- public static CommandNode getClientNode(CommandDispatcher dispatcher) {
- return AHClientCommands.getAHNode(dispatcher);
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/game/command/CommandExceptions.java b/src/main/java/org/auioc/mcmod/arnicalib/game/command/CommandExceptions.java
deleted file mode 100644
index 68d82d13..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/game/command/CommandExceptions.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.game.command;
-
-import com.mojang.brigadier.exceptions.BuiltInExceptionProvider;
-import com.mojang.brigadier.exceptions.CommandSyntaxException;
-import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
-import net.minecraft.network.chat.Component;
-import org.auioc.mcmod.arnicalib.ArnicaLib;
-
-public class CommandExceptions {
-
- public static final BuiltInExceptionProvider BUILT_IN_EXCEPTIONS = CommandSyntaxException.BUILT_IN_EXCEPTIONS;
-
- public static final SimpleCommandExceptionType INTERNAL_ERROR = simple("command.failure.internal");
- public static final SimpleCommandExceptionType LOGGABLE_INTERNAL_ERROR = simple("command.failure.internal.loggable");
- public static final SimpleCommandExceptionType NOT_SERVER_ERROR = simple("command.failure.not_server");
- public static final SimpleCommandExceptionType NOT_DEDICATED_SERVER_ERROR = simple("command.failure.not_dedicated_server");
-
- private static SimpleCommandExceptionType simple(String key) {
- return new SimpleCommandExceptionType(Component.translatable(ArnicaLib.i18n("command.failure.internal")));
- }
-
-}
diff --git a/src/main/java/org/auioc/mcmod/arnicalib/game/command/CommandHandlers.java b/src/main/java/org/auioc/mcmod/arnicalib/game/command/CommandHandlers.java
deleted file mode 100644
index e3f57356..00000000
--- a/src/main/java/org/auioc/mcmod/arnicalib/game/command/CommandHandlers.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2022-2024 AUIOC.ORG
- *
- * This file is part of ArnicaLib, a mod made for Minecraft.
- *
- * ArnicaLib is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-package org.auioc.mcmod.arnicalib.game.command;
-
-import com.mojang.brigadier.Command;
-import com.mojang.brigadier.context.CommandContext;
-import com.mojang.brigadier.exceptions.CommandSyntaxException;
-import net.minecraft.commands.CommandSourceStack;
-import net.minecraft.server.level.ServerPlayer;
-import net.minecraft.world.item.ItemStack;
-import org.auioc.mcmod.arnicalib.game.command.action.BiCommandAction;
-import org.auioc.mcmod.arnicalib.game.command.action.CommandAction;
-
-public class CommandHandlers {
-
- public static int playerSelf(CommandContext ctx, CommandAction.SingleSuccess action) throws CommandSyntaxException {
- action.accept(ctx.getSource().getPlayerOrException());
- return Command.SINGLE_SUCCESS;
- }
-
- public static int playerSelfWithMainHand(CommandContext ctx, BiCommandAction.SingleSuccess action) throws CommandSyntaxException {
- return playerSelf(ctx, (player) -> {
- if (!player.getMainHandItem().isEmpty()) action.accept(player, player.getMainHandItem());
- });
- }
-
-
- public static class MultiSuccess {
-
- public static int playerSelf(CommandContext ctx, CommandAction.MultiSuccess action) throws CommandSyntaxException {
- return action.applyAsInt(ctx.getSource().getPlayerOrException());
- }
-
- public static int playerSelfWithMainHand(CommandContext