Use libjf
This commit is contained in:
parent
64cdc96032
commit
2c882709c0
100
build.gradle
100
build.gradle
|
@ -1,19 +1,10 @@
|
|||
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://maven.terraformersmc.com/'; name = "ModMenu" }
|
||||
maven {
|
||||
name = 'TerraformersMC'
|
||||
url = 'https://maven.terraformersmc.com/'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -22,86 +13,9 @@ dependencies {
|
|||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
|
||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
|
||||
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
|
||||
// You may need to force-disable transitiveness on them.
|
||||
modCompile "me.sargunvohra.mcmods:autoconfig1u:3.3.1"
|
||||
include "me.sargunvohra.mcmods:autoconfig1u:3.3.1"
|
||||
modApi ("me.shedaniel.cloth:config-2:4.8.3") {
|
||||
exclude(group: "net.fabricmc.fabric-api")
|
||||
}
|
||||
include ("me.shedaniel.cloth:config-2:4.8.3") {
|
||||
exclude(group: "net.fabricmc.fabric-api")
|
||||
}
|
||||
download("https://gitlab.com/jfmods/LibJF/-/jobs/artifacts/master/raw/latest-dev.jar?job=build_test", "libjf")
|
||||
|
||||
modImplementation "com.terraformersmc:modmenu:1.14.15"
|
||||
}
|
||||
|
||||
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 = 'hRVfXPJj'
|
||||
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 = "400837"
|
||||
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
|
||||
}
|
||||
modImplementation "com.terraformersmc:modmenu:1.16.9"
|
||||
}
|
|
@ -3,12 +3,18 @@ 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
|
||||
yarn_mappings=1.16.5+build.9
|
||||
loader_version=0.11.3
|
||||
# Mod Properties
|
||||
mod_version=1.1.1
|
||||
mod_version=1.2.0
|
||||
maven_group=io.jfronny.gitlab
|
||||
archives_base_name=quickmeth
|
||||
# Dependencies
|
||||
# check this on https://modmuss50.me/fabric.html
|
||||
fabric_version=0.29.4+1.16
|
||||
fabric_version=0.34.2+1.16
|
||||
|
||||
modrinth_id=hRVfXPJj
|
||||
modrinth_required_dependencies=TUqoYNVF
|
||||
modrinth_optional_dependencies=Gz5wa6j2
|
||||
curseforge_id=400837
|
||||
curseforge_required_dependencies=libjf
|
||||
curseforge_optional_dependencies=modmenu
|
||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -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.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
21
gradlew.bat
vendored
21
gradlew.bat
vendored
|
@ -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
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven {
|
||||
name = 'Fabric'
|
||||
url = 'https://maven.fabricmc.net/'
|
||||
}
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
|
@ -1,20 +1,14 @@
|
|||
package io.gitlab.jfronny.quickmeth;
|
||||
|
||||
|
||||
import me.sargunvohra.mcmods.autoconfig1u.ConfigData;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.annotation.Config;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.annotation.ConfigEntry.Gui.RequiresRestart;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.shadowed.blue.endless.jankson.Comment;
|
||||
import io.gitlab.jfronny.libjf.config.Entry;
|
||||
import io.gitlab.jfronny.libjf.config.JfConfig;
|
||||
|
||||
@Config(name = "quickmeth")
|
||||
public class Cfg implements ConfigData {
|
||||
@Comment("Corrupts methods in MathHelper. This will impact many things but most notably movement")
|
||||
@RequiresRestart
|
||||
public boolean corruptGenericMath = true;
|
||||
@Comment("Corrupts methods in OctavePerlinNoiseSampler and PerlinNoiseSampler. This will mostly impact world generation")
|
||||
@RequiresRestart
|
||||
public boolean corruptPerlinNoise = true;
|
||||
@Comment("Corrupts methods in SimplexNoiseSampler. I am actually not sure what this breaks")
|
||||
@RequiresRestart
|
||||
public boolean corruptSimplexNoise = true;
|
||||
public class Cfg implements JfConfig {
|
||||
@Entry
|
||||
public static boolean corruptGenericMath = true;
|
||||
@Entry
|
||||
public static boolean corruptPerlinNoise = true;
|
||||
@Entry
|
||||
public static boolean corruptSimplexNoise = true;
|
||||
}
|
||||
|
|
|
@ -1,22 +1,8 @@
|
|||
package io.gitlab.jfronny.quickmeth;
|
||||
|
||||
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.serializer.JanksonConfigSerializer;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class quickmeth implements ModInitializer {
|
||||
public static Cfg cfg;
|
||||
static {
|
||||
AutoConfig.register(Cfg.class, JanksonConfigSerializer::new);
|
||||
cfg = AutoConfig.getConfigHolder(Cfg.class).getConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
|
||||
}
|
||||
|
||||
public class MathUtil {
|
||||
public static double BoxedInvert(double min, double max, double value) {
|
||||
return max - value + min;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package io.gitlab.jfronny.quickmeth;
|
||||
|
||||
import io.gitlab.jfronny.libjf.Libjf;
|
||||
import io.gitlab.jfronny.quickmeth.mixin.MathHelperMixin;
|
||||
import io.gitlab.jfronny.quickmeth.mixin.MixinOctavePerlinNoiseSampler;
|
||||
import io.gitlab.jfronny.quickmeth.mixin.MixinPerlinNoiseSampler;
|
||||
|
@ -26,14 +27,15 @@ public class MixinPlugin implements IMixinConfigPlugin {
|
|||
@SuppressWarnings("ReferenceToMixin")
|
||||
@Override
|
||||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
||||
Libjf.registerConfig("quickmeth", Cfg.class);
|
||||
if (Objects.equals(mixinClassName, MathHelperMixin.class.getName()))
|
||||
return quickmeth.cfg.corruptGenericMath;
|
||||
return Cfg.corruptGenericMath;
|
||||
else if (Objects.equals(mixinClassName, MixinOctavePerlinNoiseSampler.class.getName()))
|
||||
return quickmeth.cfg.corruptPerlinNoise;
|
||||
return Cfg.corruptPerlinNoise;
|
||||
else if (Objects.equals(mixinClassName, MixinPerlinNoiseSampler.class.getName()))
|
||||
return quickmeth.cfg.corruptPerlinNoise;
|
||||
return Cfg.corruptPerlinNoise;
|
||||
else if (Objects.equals(mixinClassName, MixinSimplexNoiseSampler.class.getName()))
|
||||
return quickmeth.cfg.corruptSimplexNoise;
|
||||
return Cfg.corruptSimplexNoise;
|
||||
else
|
||||
throw new IllegalStateException("Unrecognized mixin! This should never happen");
|
||||
}
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
package io.gitlab.jfronny.quickmeth;
|
||||
|
||||
import io.github.prospector.modmenu.api.ConfigScreenFactory;
|
||||
import io.github.prospector.modmenu.api.ModMenuApi;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
||||
|
||||
public class ModMenu implements ModMenuApi {
|
||||
@Override
|
||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||
return screen -> AutoConfig.getConfigScreen(Cfg.class, screen).get();
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package io.gitlab.jfronny.quickmeth.mixin;
|
||||
|
||||
import io.gitlab.jfronny.quickmeth.quickmeth;
|
||||
import io.gitlab.jfronny.quickmeth.MathUtil;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.util.Util;
|
||||
|
@ -29,7 +29,7 @@ public class MathHelperMixin {
|
|||
|
||||
@Overwrite
|
||||
public static float sin(float f) {
|
||||
return quickmeth.BoxedInvert(SINE_TABLE[(int)(f * 10430.378F) & '\uffff']);
|
||||
return MathUtil.BoxedInvert(SINE_TABLE[(int)(f * 10430.378F) & '\uffff']);
|
||||
}
|
||||
|
||||
//@Overwrite
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.gitlab.jfronny.quickmeth.mixin;
|
||||
|
||||
import io.gitlab.jfronny.quickmeth.quickmeth;
|
||||
import io.gitlab.jfronny.quickmeth.MathUtil;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.noise.PerlinNoiseSampler;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
|
@ -19,9 +19,9 @@ public class MixinPerlinNoiseSampler {
|
|||
|
||||
@Overwrite
|
||||
public double sample(double x, double y, double z, double d, double e) {
|
||||
x = quickmeth.BoxedInvert(x);
|
||||
y = quickmeth.BoxedInvert(y);
|
||||
z = quickmeth.BoxedInvert(z);
|
||||
x = MathUtil.BoxedInvert(x);
|
||||
y = MathUtil.BoxedInvert(y);
|
||||
z = MathUtil.BoxedInvert(z);
|
||||
|
||||
double f = x + this.originX;
|
||||
double g = y + this.originY;
|
||||
|
@ -43,6 +43,6 @@ public class MixinPerlinNoiseSampler {
|
|||
t = 0.0D;
|
||||
}
|
||||
|
||||
return quickmeth.BoxedInvert(((PerlinNoiseSampler)(Object)this).sample(i, j, k, l, m - t, n, o, p, q));
|
||||
return MathUtil.BoxedInvert(((PerlinNoiseSampler)(Object)this).sample(i, j, k, l, m - t, n, o, p, q));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.gitlab.jfronny.quickmeth.mixin;
|
||||
|
||||
import io.gitlab.jfronny.quickmeth.quickmeth;
|
||||
import io.gitlab.jfronny.quickmeth.MathUtil;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.noise.SimplexNoiseSampler;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
|
@ -20,8 +20,8 @@ public class MixinSimplexNoiseSampler {
|
|||
private int[] permutations;
|
||||
@Overwrite
|
||||
public double sample(double x, double y) {
|
||||
x = quickmeth.BoxedInvert(x);
|
||||
y = quickmeth.BoxedInvert(y);
|
||||
x = MathUtil.BoxedInvert(x);
|
||||
y = MathUtil.BoxedInvert(y);
|
||||
double d = (x + y) * SKEW_FACTOR_2D;
|
||||
int i = MathHelper.floor(x + d);
|
||||
int j = MathHelper.floor(y + d);
|
||||
|
@ -52,7 +52,7 @@ public class MixinSimplexNoiseSampler {
|
|||
double aa = mgrad(v, h, k, 0.0D, 0.5D);
|
||||
double ab = mgrad(w, p, q, 0.0D, 0.5D);
|
||||
double ac = mgrad(z, r, s, 0.0D, 0.5D);
|
||||
return quickmeth.BoxedInvert(70.0D * (aa + ab + ac));
|
||||
return MathUtil.BoxedInvert(70.0D * (aa + ab + ac));
|
||||
}
|
||||
|
||||
@Overwrite
|
||||
|
@ -61,10 +61,10 @@ public class MixinSimplexNoiseSampler {
|
|||
}
|
||||
|
||||
private static double mgrad(int hash, double x, double y, double z, double d) {
|
||||
x = quickmeth.BoxedInvert(x);
|
||||
y = quickmeth.BoxedInvert(y);
|
||||
z = quickmeth.BoxedInvert(z);
|
||||
d = quickmeth.BoxedInvert(d);
|
||||
x = MathUtil.BoxedInvert(x);
|
||||
y = MathUtil.BoxedInvert(y);
|
||||
z = MathUtil.BoxedInvert(z);
|
||||
d = MathUtil.BoxedInvert(d);
|
||||
|
||||
double e = d - x * x - y * y - z * z;
|
||||
double g;
|
||||
|
@ -79,6 +79,6 @@ public class MixinSimplexNoiseSampler {
|
|||
}
|
||||
|
||||
private static double mdot(int[] gArr, double x, double y, double z) {
|
||||
return quickmeth.BoxedInvert((double)gArr[0] * x + (double)gArr[1] * y + (double)gArr[2] * z);
|
||||
return MathUtil.BoxedInvert((double)gArr[0] * x + (double)gArr[1] * y + (double)gArr[2] * z);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"text.autoconfig.quickmeth.title": "QuickMäth",
|
||||
"text.autoconfig.quickmeth.option.corruptGenericMath": "Corrupt generic math",
|
||||
"text.autoconfig.quickmeth.option.corruptPerlinNoise": "Corrupt perlin noise",
|
||||
"text.autoconfig.quickmeth.option.corruptSimplexNoise": "Corrupt simplex noise"
|
||||
"quickmeth.jfconfig.title": "QuickMäth",
|
||||
"quickmeth.jfconfig.corruptGenericMath": "Corrupt generic math",
|
||||
"quickmeth.jfconfig.corruptGenericMath.tooltip": "Corrupts methods in MathHelper. This will impact many things but most notably movement",
|
||||
"quickmeth.jfconfig.corruptPerlinNoise": "Corrupt perlin noise",
|
||||
"quickmeth.jfconfig.corruptPerlinNoise.tooltip": "Corrupts methods in OctavePerlinNoiseSampler and PerlinNoiseSampler. This will mostly impact world generation",
|
||||
"quickmeth.jfconfig.corruptSimplexNoise": "Corrupt simplex noise",
|
||||
"quickmeth.jfconfig.corruptSimplexNoise.tooltip": "Corrupts methods in SimplexNoiseSampler. I am actually not sure what this breaks"
|
||||
}
|
|
@ -15,13 +15,9 @@
|
|||
"icon": "assets/quickmeth/icon.png",
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"io.gitlab.jfronny.quickmeth.quickmeth"
|
||||
],
|
||||
"modmenu": [
|
||||
"io.gitlab.jfronny.quickmeth.ModMenu"
|
||||
"libjf:config": [
|
||||
"io.gitlab.jfronny.quickmeth.Cfg"
|
||||
]
|
||||
|
||||
},
|
||||
"mixins": [
|
||||
"quickmeth.mixins.json"
|
||||
|
|
Loading…
Reference in New Issue
Block a user