1.17
This commit is contained in:
parent
347515fefe
commit
09830cd075
83
build.gradle
83
build.gradle
|
@ -1,16 +1,4 @@
|
||||||
plugins {
|
apply from: "https://gitlab.com/-/snippets/2121059/raw/master/jfbase.gradle"
|
||||||
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
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url 'https://jitpack.io' }
|
maven { url 'https://jitpack.io' }
|
||||||
|
@ -22,72 +10,5 @@ dependencies {
|
||||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
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
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,10 +2,17 @@
|
||||||
org.gradle.jvmargs=-Xmx1G
|
org.gradle.jvmargs=-Xmx1G
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://modmuss50.me/fabric.html
|
# check these on https://modmuss50.me/fabric.html
|
||||||
minecraft_version=1.16.5
|
minecraft_version=1.17-pre1
|
||||||
yarn_mappings=1.16.5+build.3
|
yarn_mappings=1.17-pre1+build.6
|
||||||
loader_version=0.11.1
|
loader_version=0.11.3
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.3.0
|
mod_version=1.4.0
|
||||||
maven_group=io.gitlab.jfronny
|
maven_group=io.gitlab.jfronny
|
||||||
archives_base_name=Slyde
|
archives_base_name=Slyde
|
||||||
|
|
||||||
|
modrinth_id=diCZrsch
|
||||||
|
modrinth_required_dependencies=
|
||||||
|
modrinth_optional_dependencies=EDbIonje
|
||||||
|
curseforge_id=411386
|
||||||
|
curseforge_required_dependencies=
|
||||||
|
curseforge_optional_dependencies=modmenu
|
||||||
|
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
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
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
@ -130,7 +130,7 @@ fi
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
|
|
@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
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_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
@ -64,21 +64,6 @@ echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
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
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
|
@ -86,7 +71,7 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@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
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
pluginManagement {
|
|
||||||
repositories {
|
|
||||||
jcenter()
|
|
||||||
maven {
|
|
||||||
name = 'Fabric'
|
|
||||||
url = 'https://maven.fabricmc.net/'
|
|
||||||
}
|
|
||||||
gradlePluginPortal()
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,42 +1,24 @@
|
||||||
package io.gitlab.jfronny.slyde.mixin;
|
package io.gitlab.jfronny.slyde.mixin;
|
||||||
|
|
||||||
import net.minecraft.client.options.DoubleOption;
|
import net.minecraft.client.option.DoubleOption;
|
||||||
import net.minecraft.util.math.MathHelper;
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
@Mixin(DoubleOption.class)
|
@Mixin(DoubleOption.class)
|
||||||
public class DoubleOptionMixin {
|
public class DoubleOptionMixin {
|
||||||
@Shadow @Final protected float step;
|
@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) {
|
||||||
@Shadow @Final protected double min;
|
return value;
|
||||||
|
|
||||||
@Shadow protected double max;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author JFronny
|
|
||||||
*/
|
|
||||||
@Overwrite
|
|
||||||
public double getRatio(double value) {
|
|
||||||
return (this.adjust(value) - this.min) / (this.max - this.min);
|
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @author JFronny
|
@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) {
|
||||||
@Overwrite
|
return value;
|
||||||
public double getValue(double ratio) {
|
|
||||||
return this.adjust(MathHelper.lerp(ratio, this.min, this.max));
|
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @author JFronny
|
@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) {
|
||||||
@Overwrite
|
|
||||||
private double adjust(double value) {
|
|
||||||
if (this.step > 0.0F) {
|
|
||||||
value = this.step * (float)Math.round(value / (double)this.step);
|
|
||||||
}
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,28 +4,13 @@ import io.gitlab.jfronny.slyde.SlydeClient;
|
||||||
import net.minecraft.client.gui.widget.SliderWidget;
|
import net.minecraft.client.gui.widget.SliderWidget;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
@Mixin(SliderWidget.class)
|
@Mixin(SliderWidget.class)
|
||||||
public abstract class SliderWidgetMixin {
|
public abstract class SliderWidgetMixin {
|
||||||
@Shadow protected double value;
|
@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) {
|
||||||
@Shadow protected abstract void applyValue();
|
return SlydeClient.isActive() ? value : MathHelper.clamp(value, min, max);
|
||||||
|
|
||||||
@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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +1,15 @@
|
||||||
package io.gitlab.jfronny.slyde.mixin;
|
package io.gitlab.jfronny.slyde.mixin;
|
||||||
|
|
||||||
import io.gitlab.jfronny.slyde.SlydeClient;
|
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 net.minecraft.util.math.MathHelper;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
@Mixin(targets = "me.jellysquid.mods.sodium.client.gui.options.control.SliderControl$Button")
|
@Mixin(targets = "me.jellysquid.mods.sodium.client.gui.options.control.SliderControl$Button")
|
||||||
public abstract class SodiumSliderControlMixin extends ControlElement<Integer> {
|
public abstract class SodiumSliderControlMixin {
|
||||||
@Shadow(remap = false) private double thumbPosition;
|
@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) {
|
||||||
public SodiumSliderControlMixin(Option<Integer> option, Dim2i dim) {
|
return SlydeClient.isActive() ? value : MathHelper.clamp(value, min, max);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"required": true,
|
"required": true,
|
||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "io.gitlab.jfronny.slyde.mixin",
|
"package": "io.gitlab.jfronny.slyde.mixin",
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_14",
|
||||||
"plugin": "io.gitlab.jfronny.slyde.Plugin",
|
"plugin": "io.gitlab.jfronny.slyde.Plugin",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue