Compare commits
3 Commits
423049ea7a
...
e83d98fdec
Author | SHA1 | Date |
---|---|---|
Johannes Frohnmeyer | e83d98fdec | |
Johannes Frohnmeyer | 3b91be9864 | |
Johannes Frohnmeyer | 02ce4ef490 |
|
@ -1,16 +1,34 @@
|
|||
import io.gitlab.jfronny.scripts.*
|
||||
|
||||
plugins {
|
||||
id("jfmod") version "1.3-SNAPSHOT"
|
||||
id("jfmod") version "1.5-SNAPSHOT"
|
||||
}
|
||||
|
||||
allprojects { group = "io.gitlab.jfronny" }
|
||||
base.archivesName = "quickmath"
|
||||
|
||||
jfMod {
|
||||
minecraftVersion = "1.20.1"
|
||||
yarn("build.10")
|
||||
loaderVersion = "0.14.22"
|
||||
libJfVersion = "3.12.5"
|
||||
|
||||
modrinth {
|
||||
projectId = "quickmath"
|
||||
requiredDependencies.add("libjf")
|
||||
optionalDependencies.add("modmenu")
|
||||
}
|
||||
curseforge {
|
||||
projectId = "400837"
|
||||
requiredDependencies.add("libjf")
|
||||
optionalDependencies.add("modmenu")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
modImplementation("io.gitlab.jfronny.libjf:libjf-config-core-v1:${prop("libjf_version")}")
|
||||
modImplementation("io.gitlab.jfronny.libjf:libjf-unsafe-v0:${prop("libjf_version")}")
|
||||
modImplementation("io.gitlab.jfronny.libjf:libjf-config-core-v1:${jfMod.libJfVersion.get()}")
|
||||
modImplementation("io.gitlab.jfronny.libjf:libjf-unsafe-v0:${jfMod.libJfVersion.get()}")
|
||||
|
||||
// Dev env
|
||||
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-config-ui-tiny-v1:${prop("libjf_version")}")
|
||||
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-devutil:${prop("libjf_version")}")
|
||||
modLocalRuntime("com.terraformersmc:modmenu:7.0.1")
|
||||
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-config-ui-tiny-v1:${jfMod.libJfVersion.get()}")
|
||||
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-devutil:${jfMod.libJfVersion.get()}")
|
||||
modLocalRuntime("com.terraformersmc:modmenu:7.2.2")
|
||||
}
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
# https://fabricmc.net/develop/
|
||||
minecraft_version=1.20
|
||||
yarn_mappings=build.1
|
||||
loader_version=0.14.21
|
||||
|
||||
maven_group=io.gitlab.jfronny
|
||||
archives_base_name=quickmath
|
||||
|
||||
modrinth_id=quickmath
|
||||
modrinth_required_dependencies=libjf
|
||||
modrinth_optional_dependencies=modmenu
|
||||
curseforge_id=400837
|
||||
curseforge_required_dependencies=libjf
|
||||
curseforge_optional_dependencies=modmenu
|
||||
|
||||
fabric_version=0.83.0+1.20
|
||||
libjf_version=3.8.0
|
|
@ -35,18 +35,18 @@ public class BytecodeTransformer implements AsmConfig {
|
|||
rnd("method_43059", "()D"), "random"
|
||||
);
|
||||
private static final Map<String, Boolean> stat = Map.of( // Maps QuickMäth MathUtil methods to booleans representing whether to overwrite them
|
||||
"sin", Cfg.corruptTrigonometry2,
|
||||
"cos", Cfg.corruptTrigonometry2,
|
||||
"sinM", Cfg.corruptTrigonometry,
|
||||
"cosM", Cfg.corruptTrigonometry,
|
||||
//"sqrt", Cfg.corruptGenericMath,
|
||||
"sqrtM", Cfg.corruptGenericMath,
|
||||
//"floor", Cfg.corruptGenericMath2,
|
||||
// "nextInt", Cfg.corruptGenericMath2,
|
||||
"nextLong", Cfg.corruptGenericMath2,
|
||||
"nextBoolean", Cfg.corruptGenericMath2,
|
||||
// "nextFloat", Cfg.corruptGenericMath2,
|
||||
"random", Cfg.corruptGenericMath2
|
||||
"sin", Cfg.corruptTrigonometry.contains(Cfg.CorruptionLevel2.FULL),
|
||||
"cos", Cfg.corruptTrigonometry.contains(Cfg.CorruptionLevel2.FULL),
|
||||
"sinM", Cfg.corruptTrigonometry.contains(Cfg.CorruptionLevel2.MAJOR),
|
||||
"cosM", Cfg.corruptTrigonometry.contains(Cfg.CorruptionLevel2.MAJOR),
|
||||
//"sqrt", Cfg.corruptGenericMath.contains(Cfg.CorruptionLevel2.MAJOR),
|
||||
"sqrtM", Cfg.corruptGenericMath.contains(Cfg.CorruptionLevel2.MAJOR),
|
||||
//"floor", Cfg.corruptGenericMath.contains(Cfg.CorruptionLevel2.FULL),
|
||||
// "nextInt", Cfg.corruptGenericMath.contains(Cfg.CorruptionLevel2.FULL),
|
||||
"nextLong", Cfg.corruptGenericMath.contains(Cfg.CorruptionLevel2.FULL),
|
||||
"nextBoolean", Cfg.corruptGenericMath.contains(Cfg.CorruptionLevel2.FULL),
|
||||
// "nextFloat", Cfg.corruptGenericMath.contains(Cfg.CorruptionLevel2.FULL),
|
||||
"random", Cfg.corruptGenericMath.contains(Cfg.CorruptionLevel2.FULL)
|
||||
);
|
||||
|
||||
private static String mth(String method, String descriptor) {
|
||||
|
|
|
@ -2,13 +2,12 @@ package io.gitlab.jfronny.quickmath;
|
|||
|
||||
import io.gitlab.jfronny.libjf.config.api.v1.Entry;
|
||||
import io.gitlab.jfronny.libjf.config.api.v1.JfConfig;
|
||||
import io.gitlab.jfronny.libjf.config.api.v1.dsl.ConfigBuilder;
|
||||
|
||||
@JfConfig
|
||||
@JfConfig(tweaker = Cfg.Migrations.class)
|
||||
public class Cfg {
|
||||
@Entry public static boolean corruptGenericMath = true;
|
||||
@Entry public static boolean corruptGenericMath2 = false;
|
||||
@Entry public static boolean corruptTrigonometry = true;
|
||||
@Entry public static boolean corruptTrigonometry2 = true;
|
||||
@Entry public static CorruptionLevel2 corruptGenericMath = CorruptionLevel2.MAJOR;
|
||||
@Entry public static CorruptionLevel2 corruptTrigonometry = CorruptionLevel2.FULL;
|
||||
@Entry public static boolean corruptPerlinNoise = true;
|
||||
@Entry public static boolean corruptSimplexNoise = true;
|
||||
@Entry public static boolean debugAsm = false;
|
||||
|
@ -16,4 +15,30 @@ public class Cfg {
|
|||
static {
|
||||
JFC_Cfg.ensureInitialized();
|
||||
}
|
||||
|
||||
public enum CorruptionLevel {
|
||||
DISABLED, MINOR, MAJOR, FULL;
|
||||
|
||||
public boolean contains(CorruptionLevel level) {
|
||||
return compareTo(level) >= 0;
|
||||
}
|
||||
}
|
||||
|
||||
public enum CorruptionLevel2 {
|
||||
DISABLED, MAJOR, FULL;
|
||||
|
||||
public boolean contains(CorruptionLevel2 level) {
|
||||
return compareTo(level) >= 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Migrations {
|
||||
public static ConfigBuilder<?> tweak(ConfigBuilder<?> builder) {
|
||||
return builder.addMigration("corruptGenericMath2", reader -> {
|
||||
if (reader.nextBoolean()) corruptGenericMath = CorruptionLevel2.FULL;
|
||||
}).addMigration("corruptTrigonometry2", reader -> {
|
||||
if (!reader.nextBoolean()) corruptTrigonometry = CorruptionLevel2.MAJOR;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
package io.gitlab.jfronny.quickmath;
|
||||
|
||||
import io.gitlab.jfronny.quickmath.mixin.*;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
public class MixinPlugin implements IMixinConfigPlugin {
|
||||
private static final String PREFIX = "io.gitlab.jfronny.quickmath.mixin.";
|
||||
@Override
|
||||
public void onLoad(String mixinPackage) {
|
||||
|
||||
|
@ -20,19 +19,17 @@ public class MixinPlugin implements IMixinConfigPlugin {
|
|||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("ReferenceToMixin")
|
||||
@Override
|
||||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
||||
if (Objects.equals(mixinClassName, MathHelperMixin.class.getName()))
|
||||
return Cfg.corruptGenericMath;
|
||||
else if (Objects.equals(mixinClassName, MathHelperMixin2.class.getName()))
|
||||
return Cfg.corruptGenericMath2;
|
||||
else if (Objects.equals(mixinClassName, MixinPerlinNoiseSampler.class.getName()))
|
||||
return Cfg.corruptPerlinNoise;
|
||||
else if (Objects.equals(mixinClassName, MixinSimplexNoiseSampler.class.getName()))
|
||||
return Cfg.corruptSimplexNoise;
|
||||
else
|
||||
throw new IllegalStateException("Unrecognized mixin! This should never happen");
|
||||
if (!mixinClassName.startsWith(PREFIX))
|
||||
throw new IllegalStateException("Unrecognized mixin! This should never happen: " + mixinClassName);
|
||||
return switch (mixinClassName.substring(PREFIX.length())) {
|
||||
case "MathHelperMixin" -> Cfg.corruptGenericMath.contains(Cfg.CorruptionLevel2.MAJOR);
|
||||
case "MathHelperMixin2" -> Cfg.corruptGenericMath.contains(Cfg.CorruptionLevel2.FULL);
|
||||
case "MixinPerlinNoiseSampler" -> Cfg.corruptPerlinNoise;
|
||||
case "MixinSimplexNoiseSampler" -> Cfg.corruptSimplexNoise;
|
||||
default -> throw new IllegalStateException("Unrecognized mixin! This should never happen: " + mixinClassName);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
{
|
||||
"quickmath.jfconfig.title": "QuickMäth - Restart to apply changes",
|
||||
"quickmath.jfconfig.title": "QuickMäth",
|
||||
"quickmath.jfconfig.tooltip": "Restart to apply changes",
|
||||
"quickmath.jfconfig.corruptGenericMath": "Corrupt generic math",
|
||||
"quickmath.jfconfig.corruptGenericMath.tooltip": "Corrupts methods in MathHelper. This will impact many things but most notably movement",
|
||||
"quickmath.jfconfig.corruptGenericMath2": "Corrupt more generic math",
|
||||
"quickmath.jfconfig.corruptGenericMath2.tooltip": "Corrupts more methods in MathHelper. These WILL break a lot of things so they are separate",
|
||||
"quickmath.jfconfig.corruptTrigonometry": "Corrupt Trigonometry",
|
||||
"quickmath.jfconfig.corruptTrigonometry.tooltip": "Corrupts trigonometry methods. Effects vary",
|
||||
"quickmath.jfconfig.corruptTrigonometry2": "Corrupt more Trigonometry",
|
||||
"quickmath.jfconfig.corruptTrigonometry2.tooltip": "Corrupts all trigonometry methods. This WILL break a lot of things",
|
||||
"quickmath.jfconfig.corruptPerlinNoise": "Corrupt perlin noise",
|
||||
"quickmath.jfconfig.corruptPerlinNoise.tooltip": "Corrupts methods in OctavePerlinNoiseSampler and PerlinNoiseSampler. This will mostly impact world generation",
|
||||
"quickmath.jfconfig.corruptSimplexNoise": "Corrupt simplex noise",
|
||||
"quickmath.jfconfig.corruptSimplexNoise.tooltip": "Corrupts methods in SimplexNoiseSampler. I am actually not sure what this breaks",
|
||||
"quickmath.jfconfig.debugAsm": "Debug ASM",
|
||||
"quickmath.jfconfig.debugAsm.tooltip": "Prints debug messages for the purpose of debugging"
|
||||
"quickmath.jfconfig.debugAsm.tooltip": "Prints debug messages for the purpose of debugging",
|
||||
"quickmath.jfconfig.enum.CorruptionLevel2.DISABLED": "Disabled",
|
||||
"quickmath.jfconfig.enum.CorruptionLevel2.MAJOR": "Major",
|
||||
"quickmath.jfconfig.enum.CorruptionLevel2.FULL": "Full",
|
||||
"quickmath.jfconfig.enum.CorruptionLevel.DISABLED": "Disabled",
|
||||
"quickmath.jfconfig.enum.CorruptionLevel.MINOR": "Minor",
|
||||
"quickmath.jfconfig.enum.CorruptionLevel.MAJOR": "Major",
|
||||
"quickmath.jfconfig.enum.CorruptionLevel.FULL": "Full"
|
||||
}
|
Loading…
Reference in New Issue