diff --git a/build.gradle b/build.gradle index 8b5d349..49583a1 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { - id "fabric-loom" version "1.5.+" - id "com.github.johnrengelman.shadow" version "7.1.2" + id "fabric-loom" version "1.6.+" + id "com.github.johnrengelman.shadow" version "7.1.+" id "com.modrinth.minotaur" version "2.+" } @@ -25,7 +25,6 @@ dependencies { mappings("org.quiltmc:quilt-mappings:${project.minecraft_version}+build.${project.quilt_mappings}:intermediary-v2") modImplementation("net.fabricmc:fabric-loader:${project.loader_version}") - include(modImplementation("dev.lambdaurora:spruceui:${project.spruceui_version}")) modImplementation("com.terraformersmc:modmenu:${project.mod_menu_version}") Set apiModules = [ diff --git a/gradle.properties b/gradle.properties index 22ba06d..a9ba895 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,17 +3,16 @@ org.gradle.jvmargs=-Xmx1G # minecraft, mappings and loader dependencies # check these on https://modmuss50.me/fabric.html -minecraft_version=1.20.4 +minecraft_version=1.20.6 quilt_mappings=3 loader_version=0.15.7 # mod properties -mod_version=1.2.0+mc1.20.4 +mod_version=1.2.0+mc1.20.6 maven_group=rainglow archives_base_name=rainglow # other dependencies -java_version=17 -spruceui_version=5.0.3+1.20.4 +java_version=21 mod_menu_version=9.0.0 -fabric_api_version=0.96.4+1.20.4 +fabric_api_version=0.97.8+1.20.6 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 033e24c..e644113 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 ac72c34..b82aa23 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index fcb6fca..1aa94a4 100755 --- a/gradlew +++ b/gradlew @@ -83,7 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -144,7 +145,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 +153,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 @@ -201,11 +202,11 @@ fi # 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, 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. +# 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 93e3f59..25da30d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ 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. +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 @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/src/main/java/io/ix0rai/rainglow/config/CustomModeScreen.java b/src/main/java/io/ix0rai/rainglow/config/CustomModeScreen.java index b0537a2..9f18df3 100644 --- a/src/main/java/io/ix0rai/rainglow/config/CustomModeScreen.java +++ b/src/main/java/io/ix0rai/rainglow/config/CustomModeScreen.java @@ -1,27 +1,28 @@ package io.ix0rai.rainglow.config; -import dev.lambdaurora.spruceui.Position; -import dev.lambdaurora.spruceui.option.SpruceBooleanOption; -import dev.lambdaurora.spruceui.option.SpruceOption; -import dev.lambdaurora.spruceui.option.SpruceSimpleActionOption; -import dev.lambdaurora.spruceui.widget.container.SpruceOptionListWidget; import io.ix0rai.rainglow.Rainglow; import io.ix0rai.rainglow.data.RainglowColour; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.option.SimpleOptionsScreen; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -public class CustomModeScreen extends RainglowScreen { +public class CustomModeScreen extends SimpleOptionsScreen { private final SpruceOption clearOption; private final SpruceOption saveOption; private final SpruceBooleanOption[] colourToggles = new SpruceBooleanOption[RainglowColour.values().length]; private final boolean[] toggleStates = new boolean[RainglowColour.values().length]; public CustomModeScreen(@Nullable Screen parent) { - super(parent, Rainglow.translatableText("config.title")); + super(parent, MinecraftClient.getInstance().options, Rainglow.translatableText("config.title"), + + ); + + // todo subclass option to allow saving via a save button + // ephemeral value, not saved until a specific method is called (will happen on save pressed) // create toggles for each colour for (int i = 0; i < RainglowColour.values().length; i ++) { diff --git a/src/main/java/io/ix0rai/rainglow/config/DeferredSaveOption.java b/src/main/java/io/ix0rai/rainglow/config/DeferredSaveOption.java new file mode 100644 index 0000000..df95d9d --- /dev/null +++ b/src/main/java/io/ix0rai/rainglow/config/DeferredSaveOption.java @@ -0,0 +1,7 @@ +package io.ix0rai.rainglow.config; + +import net.minecraft.client.option.Option; + +public class DeferredSaveOption extends Option { + private final T deferredValue; +} diff --git a/src/main/java/io/ix0rai/rainglow/config/RainglowConfigScreen.java b/src/main/java/io/ix0rai/rainglow/config/RainglowConfigScreen.java index 8b2792f..5e2f017 100644 --- a/src/main/java/io/ix0rai/rainglow/config/RainglowConfigScreen.java +++ b/src/main/java/io/ix0rai/rainglow/config/RainglowConfigScreen.java @@ -1,19 +1,12 @@ package io.ix0rai.rainglow.config; -import dev.lambdaurora.spruceui.Position; -import dev.lambdaurora.spruceui.option.SpruceBooleanOption; -import dev.lambdaurora.spruceui.option.SpruceCyclingOption; -import dev.lambdaurora.spruceui.option.SpruceIntegerInputOption; -import dev.lambdaurora.spruceui.option.SpruceOption; -import dev.lambdaurora.spruceui.option.SpruceSimpleActionOption; -import dev.lambdaurora.spruceui.widget.SpruceLabelWidget; -import dev.lambdaurora.spruceui.widget.container.SpruceOptionListWidget; import io.ix0rai.rainglow.Rainglow; import io.ix0rai.rainglow.data.RainglowColour; import io.ix0rai.rainglow.data.RainglowEntity; import io.ix0rai.rainglow.data.RainglowMode; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.option.Option; import net.minecraft.client.toast.SystemToast; import net.minecraft.client.toast.Toast; import net.minecraft.text.Style; @@ -39,6 +32,7 @@ public class RainglowConfigScreen extends RainglowScreen { public RainglowConfigScreen(@Nullable Screen parent) { super(parent, Rainglow.translatableText("config.title")); + Option.ofBoolean() this.mode = Rainglow.CONFIG.getMode(); // mode option cycles through available modes @@ -171,7 +165,7 @@ private SpruceLabelWidget createColourListLabel(String translationKey, RainglowM } private static void sendConfigLockedToast() { - Toast toast = new SystemToast(SystemToast.C_ozahoshp.field_47585, Rainglow.translatableText("config.server_locked_title"), Rainglow.translatableText("config.server_locked_description")); + Toast toast = new SystemToast(SystemToast.Id.PACK_LOAD_FAILURE, Rainglow.translatableText("config.server_locked_title"), Rainglow.translatableText("config.server_locked_description")); MinecraftClient.getInstance().getToastManager().add(toast); } } diff --git a/src/main/java/io/ix0rai/rainglow/config/RainglowScreen.java b/src/main/java/io/ix0rai/rainglow/config/RainglowScreen.java deleted file mode 100644 index e5759a5..0000000 --- a/src/main/java/io/ix0rai/rainglow/config/RainglowScreen.java +++ /dev/null @@ -1,24 +0,0 @@ -package io.ix0rai.rainglow.config; - -import dev.lambdaurora.spruceui.screen.SpruceScreen; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.text.Text; -import org.jetbrains.annotations.Nullable; - -public abstract class RainglowScreen extends SpruceScreen { - protected final Screen parent; - - protected RainglowScreen(@Nullable Screen parent, Text title) { - super(title); - this.parent = parent; - } - - @Override - public void closeScreen() { - if (this.client != null) { - this.client.setScreen(this.parent); - } else { - super.closeScreen(); - } - } -} diff --git a/src/main/java/io/ix0rai/rainglow/mixin/AllayEntityMixin.java b/src/main/java/io/ix0rai/rainglow/mixin/AllayEntityMixin.java index 2c7ab16..fd58826 100644 --- a/src/main/java/io/ix0rai/rainglow/mixin/AllayEntityMixin.java +++ b/src/main/java/io/ix0rai/rainglow/mixin/AllayEntityMixin.java @@ -26,7 +26,7 @@ protected AllayEntityMixin(EntityType entityType, World w @Inject(method = "initDataTracker", at = @At("TAIL")) protected void initDataTracker(CallbackInfo ci) { - this.getDataTracker().startTracking(Rainglow.getTrackedColourData(RainglowEntity.ALLAY), RainglowColour.BLUE.getId()); + this.getDataTracker().set(Rainglow.getTrackedColourData(RainglowEntity.ALLAY), RainglowColour.BLUE.getId()); } @Inject(method = "writeCustomDataToNbt", at = @At("TAIL")) diff --git a/src/main/java/io/ix0rai/rainglow/mixin/client/AllayEntityRendererMixin.java b/src/main/java/io/ix0rai/rainglow/mixin/client/AllayEntityRendererMixin.java index b1ae55c..7efc1f6 100644 --- a/src/main/java/io/ix0rai/rainglow/mixin/client/AllayEntityRendererMixin.java +++ b/src/main/java/io/ix0rai/rainglow/mixin/client/AllayEntityRendererMixin.java @@ -3,7 +3,7 @@ import io.ix0rai.rainglow.Rainglow; import io.ix0rai.rainglow.data.RainglowColour; import io.ix0rai.rainglow.data.RainglowEntity; -import net.minecraft.client.render.entity.AllayRenderer; +import net.minecraft.client.render.entity.AllayEntityRenderer; import net.minecraft.entity.passive.AllayEntity; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; @@ -11,7 +11,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -@Mixin(AllayRenderer.class) +@Mixin(AllayEntityRenderer.class) public class AllayEntityRendererMixin { @Inject(method = "getTexture*", at = @At("HEAD"), cancellable = true) diff --git a/src/main/java/io/ix0rai/rainglow/mixin/client/SquidInkParticleMixin.java b/src/main/java/io/ix0rai/rainglow/mixin/client/SquidInkParticleMixin.java index 11f77e6..797c136 100644 --- a/src/main/java/io/ix0rai/rainglow/mixin/client/SquidInkParticleMixin.java +++ b/src/main/java/io/ix0rai/rainglow/mixin/client/SquidInkParticleMixin.java @@ -50,7 +50,7 @@ public void createParticle(DefaultParticleType defaultParticleType, ClientWorld rgb = RainglowColour.WHITE.getInkRgb(); } - cir.setReturnValue(new SquidInkParticle(clientWorld, d, e, f, g, h, i, ColorUtil.ARGB32.getArgb(255, (int) rgb.r(), (int) rgb.g(), (int) rgb.b()), this.spriteProvider)); + cir.setReturnValue(new SquidInkParticle(clientWorld, d, e, f, g, h, i, ColorUtil.Argb32.of(255, (int) rgb.r(), (int) rgb.g(), (int) rgb.b()), this.spriteProvider)); } } } diff --git a/src/main/resources/rainglow.accesswidener b/src/main/resources/rainglow.accesswidener index 686ef2c..e19e9f7 100644 --- a/src/main/resources/rainglow.accesswidener +++ b/src/main/resources/rainglow.accesswidener @@ -1,6 +1,7 @@ accessWidener v1 named accessible class net/minecraft/client/particle/GlowParticle$GlowFactory +extendable class net/minecraft/client/option/Option accessible method net/minecraft/client/particle/GlowParticle (Lnet/minecraft/client/world/ClientWorld;DDDDDDLnet/minecraft/client/particle/SpriteProvider;)V accessible field net/minecraft/client/particle/GlowParticle RANDOM Lnet/minecraft/util/random/RandomGenerator;