diff --git a/build.gradle b/build.gradle index 5d386eb..b23f253 100644 --- a/build.gradle +++ b/build.gradle @@ -1,16 +1,4 @@ -plugins { - id 'fabric-loom' version '0.5-SNAPSHOT' - id 'maven-publish' - id "com.modrinth.minotaur" version "1.1.0" - id "com.matthewprenger.cursegradle" version "1.4.0" -} - -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 - -archivesBaseName = project.archives_base_name -version = project.mod_version -group = project.maven_group +apply from: "https://gitlab.com/-/snippets/2121059/raw/master/jfbase.gradle" repositories { maven { url 'https://jitpack.io' } @@ -22,72 +10,5 @@ dependencies { mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - modImplementation 'com.github.jellysquid3:sodium-fabric:mc1.16.3-0.1.0' + modImplementation "com.github.jellysquid3:sodium-fabric:mc1.16.3-0.1.0" } - -processResources { - inputs.property "version", project.version - - from(sourceSets.main.resources.srcDirs) { - include "fabric.mod.json" - expand "version": project.version - } - - from(sourceSets.main.resources.srcDirs) { - exclude "fabric.mod.json" - } -} - -// ensure that the encoding is set to UTF-8, no matter what the system default is -// this fixes some edge cases with special characters not displaying correctly -// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html -tasks.withType(JavaCompile) { - options.encoding = "UTF-8" -} - -// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task -// if it is present. -// If you remove this task, sources will not be generated. -task sourcesJar(type: Jar, dependsOn: classes) { - classifier = "sources" - from sourceSets.main.allSource -} - -jar { - from "LICENSE" -} - -import com.modrinth.minotaur.TaskModrinthUpload - -task publishModrinth (type: TaskModrinthUpload){ - token = System.getenv("MODRINTH_API_TOKEN") // Use an environment property! - projectId = 'diCZrsch' - versionNumber = "${project.mod_version}" - uploadFile = remapJar // This is the java jar task - addGameVersion("${project.minecraft_version}") - addLoader('fabric') - versionName = "[${project.minecraft_version}] ${project.mod_version}" - afterEvaluate { - tasks.publishModrinth.dependsOn(remapJar) - tasks.publishModrinth.dependsOn(sourcesJar) - } -} - -curseforge { - apiKey = System.getenv("CURSEFORGE_API_TOKEN") == null ? "###" : System.getenv("CURSEFORGE_API_TOKEN") - project { - id = "411386" - releaseType = 'release' - addGameVersion "Fabric" - addGameVersion "${project.minecraft_version}" - changelog = "" - mainArtifact(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar")) - mainArtifact.displayName = "[${project.minecraft_version}] ${project.mod_version}" - afterEvaluate { - uploadTask.dependsOn(remapJar) - } - } - options { - forgeGradleIntegration = false - } -} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 5f54082..54d8ca2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,10 +2,17 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://modmuss50.me/fabric.html -minecraft_version=1.16.5 -yarn_mappings=1.16.5+build.3 -loader_version=0.11.1 +minecraft_version=1.17-pre1 +yarn_mappings=1.17-pre1+build.6 +loader_version=0.11.3 # Mod Properties -mod_version=1.3.0 +mod_version=1.4.0 maven_group=io.gitlab.jfronny archives_base_name=Slyde + +modrinth_id=diCZrsch +modrinth_required_dependencies= +modrinth_optional_dependencies=EDbIonje +curseforge_id=411386 +curseforge_required_dependencies= +curseforge_optional_dependencies=modmenu diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 62d4c05..e708b1c 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 bb8b2fc..f371643 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index fbd7c51..4f906e0 100644 --- a/gradlew +++ b/gradlew @@ -130,7 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/gradlew.bat b/gradlew.bat index 5093609..107acd3 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -54,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -64,21 +64,6 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line @@ -86,7 +71,7 @@ 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 %CMD_LINE_ARGS% +"%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 diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 5b60df3..0000000 --- a/settings.gradle +++ /dev/null @@ -1,10 +0,0 @@ -pluginManagement { - repositories { - jcenter() - maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' - } - gradlePluginPortal() - } -} diff --git a/src/main/java/io/gitlab/jfronny/slyde/mixin/DoubleOptionMixin.java b/src/main/java/io/gitlab/jfronny/slyde/mixin/DoubleOptionMixin.java index 8f853bd..7b603a7 100644 --- a/src/main/java/io/gitlab/jfronny/slyde/mixin/DoubleOptionMixin.java +++ b/src/main/java/io/gitlab/jfronny/slyde/mixin/DoubleOptionMixin.java @@ -1,42 +1,24 @@ package io.gitlab.jfronny.slyde.mixin; -import net.minecraft.client.options.DoubleOption; -import net.minecraft.util.math.MathHelper; -import org.spongepowered.asm.mixin.Final; +import net.minecraft.client.option.DoubleOption; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; @Mixin(DoubleOption.class) public class DoubleOptionMixin { - @Shadow @Final protected float step; - - @Shadow @Final protected double min; - - @Shadow protected double max; - - /** - * @author JFronny - */ - @Overwrite - public double getRatio(double value) { - return (this.adjust(value) - this.min) / (this.max - this.min); + @Redirect(method = "getRatio(D)D", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;clamp(DDD)D")) + private double getRatioClamp(double value, double min, double max) { + return value; } - /** - * @author JFronny - */ - @Overwrite - public double getValue(double ratio) { - return this.adjust(MathHelper.lerp(ratio, this.min, this.max)); + + @Redirect(method = "getValue(D)D", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;clamp(DDD)D")) + private double getValueClamp(double value, double min, double max) { + return value; } - /** - * @author JFronny - */ - @Overwrite - private double adjust(double value) { - if (this.step > 0.0F) { - value = this.step * (float)Math.round(value / (double)this.step); - } + + @Redirect(method = "adjust(D)D", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;clamp(DDD)D")) + private double adjustClamp(double value, double min, double max) { return value; } } diff --git a/src/main/java/io/gitlab/jfronny/slyde/mixin/SliderWidgetMixin.java b/src/main/java/io/gitlab/jfronny/slyde/mixin/SliderWidgetMixin.java index 17cb4bc..274a558 100644 --- a/src/main/java/io/gitlab/jfronny/slyde/mixin/SliderWidgetMixin.java +++ b/src/main/java/io/gitlab/jfronny/slyde/mixin/SliderWidgetMixin.java @@ -4,28 +4,13 @@ import io.gitlab.jfronny.slyde.SlydeClient; import net.minecraft.client.gui.widget.SliderWidget; import net.minecraft.util.math.MathHelper; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; @Mixin(SliderWidget.class) public abstract class SliderWidgetMixin { - @Shadow protected double value; - - @Shadow protected abstract void applyValue(); - - @Shadow protected abstract void updateMessage(); - - /** - * @author JFronny - */ - @Overwrite - private void setValue(double mouseX) { - double d = value; - value = SlydeClient.isActive() ? mouseX : MathHelper.clamp(mouseX, 0.0D, 1.0D); - if (d != value) { - applyValue(); - } - - updateMessage(); + @Redirect(method = "setValue(D)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;clamp(DDD)D")) + private double adjustClamp(double value, double min, double max) { + return SlydeClient.isActive() ? value : MathHelper.clamp(value, min, max); } } diff --git a/src/main/java/io/gitlab/jfronny/slyde/mixin/SodiumSliderControlMixin.java b/src/main/java/io/gitlab/jfronny/slyde/mixin/SodiumSliderControlMixin.java index b2e44c1..e1c0f33 100644 --- a/src/main/java/io/gitlab/jfronny/slyde/mixin/SodiumSliderControlMixin.java +++ b/src/main/java/io/gitlab/jfronny/slyde/mixin/SodiumSliderControlMixin.java @@ -1,34 +1,15 @@ package io.gitlab.jfronny.slyde.mixin; import io.gitlab.jfronny.slyde.SlydeClient; -import me.jellysquid.mods.sodium.client.gui.options.Option; -import me.jellysquid.mods.sodium.client.gui.options.control.ControlElement; -import me.jellysquid.mods.sodium.client.util.Dim2i; import net.minecraft.util.math.MathHelper; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; @Mixin(targets = "me.jellysquid.mods.sodium.client.gui.options.control.SliderControl$Button") -public abstract class SodiumSliderControlMixin extends ControlElement { - @Shadow(remap = false) private double thumbPosition; - - public SodiumSliderControlMixin(Option option, Dim2i dim) { - super(option, dim); - } - - @Shadow(remap = false) public abstract int getIntValue(); - - /** - * @author JFronny - * @reason Removing the MathHelper.clamp call would be a pain any other way - */ - @Overwrite(remap = false) - private void setValue(double d) { - this.thumbPosition = SlydeClient.isActive() ? d : MathHelper.clamp(d, 0.0D, 1.0D); - int value = this.getIntValue(); - if (this.option.getValue() != value) { - this.option.setValue(value); - } +public abstract class SodiumSliderControlMixin { + @Redirect(method = "setValue(D)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;clamp(DDD)D")) + private double adjustClamp(double value, double min, double max) { + return SlydeClient.isActive() ? value : MathHelper.clamp(value, min, max); } } diff --git a/src/main/resources/slyde.mixins.json b/src/main/resources/slyde.mixins.json index c08ab7f..2d02e37 100644 --- a/src/main/resources/slyde.mixins.json +++ b/src/main/resources/slyde.mixins.json @@ -2,7 +2,7 @@ "required": true, "minVersion": "0.8", "package": "io.gitlab.jfronny.slyde.mixin", - "compatibilityLevel": "JAVA_8", + "compatibilityLevel": "JAVA_14", "plugin": "io.gitlab.jfronny.slyde.Plugin", "mixins": [ ],