diff --git a/build.gradle b/build.gradle index 501c5cb..933dc41 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.6-SNAPSHOT' + id 'fabric-loom' version '1.16-SNAPSHOT' id 'maven-publish' id "me.modmuss50.mod-publish-plugin" version "0.5.1" } @@ -12,14 +12,10 @@ base { } repositories { - // Add repositories to retrieve artifacts from in here. - // You should only use this when depending on other mods because - // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. - // See https://docs.gradle.org/current/userguide/declaring_repositories.html - // for more information about repositories. maven { url "https://maven.wispforest.io/releases/" } - maven { url "https://maven.axoga.to/releases" } + //maven { url "https://maven.axoga.to/releases" } // no longer online, not really relevant? maven { url "https://api.modrinth.com/maven" } + maven { url 'https://jitpack.io' } } loom { diff --git a/gradle.properties b/gradle.properties index cb3724b..5f13292 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ org.gradle.parallel=true # check these on https://fabricmc.net/develop minecraft_version=1.21 yarn_mappings=1.21+build.4 -loader_version=0.15.11 +loader_version=0.19.0 # Mod Properties mod_name=Particular @@ -16,6 +16,6 @@ archives_base_name=particular # Dependencies fabric_version=0.100.3+1.21 -owo_version=0.12.10+1.21 +owo_version=0.13.0-alpha.15+1.21 sushi_version=0.2.1+1.21 seasons_version=2.2.1+1.20 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e644113..b1b8ef5 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 a441313..b52fb7e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,9 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip networkTimeout=10000 +retries=0 +retryBackOffMs=500 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 index 1aa94a4..b9bb139 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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/3d91ce3b8caaf77ad09f381f43615b715b53f72c/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/. @@ -84,7 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -112,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -170,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -203,15 +203,14 @@ fi 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, +# * DEFAULT_JVM_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" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 25da30d..24c62d5 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @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 ########################################################################## @@ -21,8 +23,8 @@ @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @@ -49,7 +51,7 @@ 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 +"%COMSPEC%" /c exit 1 :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -63,30 +65,18 @@ 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 +"%COMSPEC%" /c exit 1 :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 +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel -:omega +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/src/main/java/com/chailotl/particular/mixin/InjectConfigWrapper.java b/src/main/java/com/chailotl/particular/mixin/InjectConfigWrapper.java index 951777d..ff59767 100644 --- a/src/main/java/com/chailotl/particular/mixin/InjectConfigWrapper.java +++ b/src/main/java/com/chailotl/particular/mixin/InjectConfigWrapper.java @@ -1,40 +1,36 @@ package com.chailotl.particular.mixin; -import blue.endless.jankson.Jankson; import com.chailotl.particular.sushi_bar.owo.config.SushiConfigScreen; import com.chailotl.particular.sushi_bar.owo.config.SushiModmenu; +import com.llamalad7.mixinextras.expression.Definition; +import com.llamalad7.mixinextras.expression.Expression; import io.wispforest.owo.config.ConfigWrapper; -import io.wispforest.owo.config.ui.ConfigScreen; -import net.fabricmc.api.EnvType; -import net.fabricmc.loader.api.FabricLoader; +import io.wispforest.owo.config.annotation.Modmenu; +import io.wispforest.owo.config.ui.ConfigScreenProviders; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.util.function.Consumer; - -@Pseudo @Mixin(ConfigWrapper.class) public class InjectConfigWrapper { + @Definition(id = "getAnnotation", method = "Ljava/lang/Class;getAnnotation(Ljava/lang/Class;)Ljava/lang/annotation/Annotation;") + @Definition(id = "ModMenu", type = Modmenu.class) + @Expression("?.getAnnotation(ModMenu.class)") @Inject( - method = "(Ljava/lang/Class;Ljava/util/function/Consumer;)V", - at = @At( - value = "INVOKE", - target = "Lnet/fabricmc/loader/api/FabricLoader;getEnvironmentType()Lnet/fabricmc/api/EnvType;" - ) + method = "(Ljava/lang/Class;Lio/wispforest/owo/config/ConfigWrapper$BuilderConsumer;)V", + at = @At(value = "MIXINEXTRAS:EXPRESSION") ) - private void injectSushiModmenu(Class clazz, Consumer janksonBuilder, CallbackInfo info) + private void injectSushiModmenu(Class clazz, ConfigWrapper.BuilderConsumer consumer, CallbackInfo ci) { - if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT && clazz.isAnnotationPresent(SushiModmenu.class)) + if (clazz.isAnnotationPresent(SushiModmenu.class)) { - SushiModmenu annotation = clazz.getAnnotation(SushiModmenu.class); - ConfigScreen.registerProvider( - annotation.modId(), - screen -> SushiConfigScreen.createWithCustomModel(Identifier.of(annotation.uiModelId()), (ConfigWrapper)(Object)this, screen) + SushiModmenu annotation = (SushiModmenu) clazz.getAnnotation(SushiModmenu.class); + ConfigScreenProviders.register( + annotation.modId(), + screen -> SushiConfigScreen.createWithCustomModel(Identifier.of(annotation.uiModelId()), (ConfigWrapper)(Object)this, screen) ); } } diff --git a/src/main/java/com/chailotl/particular/mixin/InvokerViewerCountManager.java b/src/main/java/com/chailotl/particular/mixin/InvokerViewerCountManager.java index b56d224..f39846e 100644 --- a/src/main/java/com/chailotl/particular/mixin/InvokerViewerCountManager.java +++ b/src/main/java/com/chailotl/particular/mixin/InvokerViewerCountManager.java @@ -1,5 +1,7 @@ package com.chailotl.particular.mixin; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; import net.minecraft.block.BlockState; import net.minecraft.block.entity.ViewerCountManager; import net.minecraft.util.math.BlockPos; @@ -7,15 +9,13 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Invoker; +@Environment(EnvType.CLIENT) @Mixin(ViewerCountManager.class) public interface InvokerViewerCountManager { @Invoker - public abstract void invokeOnContainerOpen(World world, BlockPos pos, BlockState state); + void invokeOnContainerOpen(World world, BlockPos pos, BlockState state); @Invoker - public abstract void invokeOnContainerClose(World world, BlockPos pos, BlockState state); - - @Invoker - public abstract void invokeScheduleBlockTick(World world, BlockPos pos, BlockState state); + void invokeOnContainerClose(World world, BlockPos pos, BlockState state); } diff --git a/src/main/java/com/chailotl/particular/sushi_bar/owo/config/SushiConfigScreen.java b/src/main/java/com/chailotl/particular/sushi_bar/owo/config/SushiConfigScreen.java index 4b978ba..0e0e879 100644 --- a/src/main/java/com/chailotl/particular/sushi_bar/owo/config/SushiConfigScreen.java +++ b/src/main/java/com/chailotl/particular/sushi_bar/owo/config/SushiConfigScreen.java @@ -2,6 +2,7 @@ import io.wispforest.owo.config.ConfigWrapper; import io.wispforest.owo.config.ui.ConfigScreen; +import io.wispforest.owo.config.ui.ConfigScreenProviders; import io.wispforest.owo.config.ui.OptionComponentFactory; import io.wispforest.owo.util.ReflectionUtils; import net.minecraft.client.gui.screen.Screen; @@ -33,9 +34,8 @@ public static SushiConfigScreen createWithCustomModel(Identifier modelId, Config return new SushiConfigScreen(modelId, config, parent); } - public static void registerConfig(String modId, ConfigWrapper config) - { - ConfigScreen.registerProvider(modId, screen -> new SushiConfigScreen(config, screen)); + public static void registerConfig(String modId, ConfigWrapper config) { + ConfigScreenProviders.register(modId, screen -> new SushiConfigScreen(config, screen)); } private static boolean isIdentifierList(Field field) diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 3f1991c..ddc7b52 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -5,7 +5,21 @@ "name": "${name}", "description": "Enhances Minecraft's ambience with hand-crafted visual effects like fireflies, falling leaves, and waterfall cascades", "authors": [ - "Chai" + { + "name": "Chai", + "contact": { + "homepage": "https://axoga.to/", + "sources": "https://github.com/Chailotl/" + } + } + ], + "contributors": [ + { + "name": "Nerjal Nosk", + "contact": { + "homepage": "https://codeberg.org/NerjalNosk/" + } + } ], "contact": { "homepage": "https://modrinth.com/mod/particular/", @@ -15,7 +29,8 @@ "custom": { "modmenu": { "links": { - "modmenu.discord": "https://discord.gg/SuZb3aJUCx" + "modmenu.discord": "https://discord.gg/SuZb3aJUCx", + "modmenu.buymeacoffee": "https://www.buymeacoffee.com/chailotl" } } }, diff --git a/src/main/resources/particular.mixins.json b/src/main/resources/particular.mixins.json index 3aab3c7..1b5d244 100644 --- a/src/main/resources/particular.mixins.json +++ b/src/main/resources/particular.mixins.json @@ -2,12 +2,12 @@ "required": true, "package": "com.chailotl.particular.mixin", "compatibilityLevel": "JAVA_17", - "mixins": [ - "InvokerViewerCountManager" - ], "injectors": { "defaultRequire": 1 }, + "mixinextras": { + "minVersion": "0.5.0-beta.1" + }, "client": [ "AccessorBillboardParticle", "AccessorBiome", @@ -22,6 +22,7 @@ "InjectCakeBlock", "InjectChestBlock", "InjectChestBlockEntity", + "InjectConfigWrapper", "InjectContinuousFalling", "InjectEnderChestBlock", "InjectEnderChestBlockEntity", @@ -32,6 +33,6 @@ "InjectWaterFluid", "InjectWorldRenderer", "InvokerLivingEntity", - "InjectConfigWrapper" + "InvokerViewerCountManager" ] }