Use quickmath as the mod id for consistency
This commit is contained in:
parent
c80a2105e3
commit
3fdfc097cb
|
@ -1,4 +1,4 @@
|
||||||
Quickmeth allows you to break math methods in minecraft by enabling replacements for:
|
QuickMäth allows you to break math methods in minecraft by enabling replacements for:
|
||||||
- The standard math methods (used almost everywhere where math is needed)
|
- The standard math methods (used almost everywhere where math is needed)
|
||||||
- Trigonometry (which is also used across the codebase and affect things like rendering)
|
- Trigonometry (which is also used across the codebase and affect things like rendering)
|
||||||
- Perlin & Simplex noise methods (used in terrain generation)
|
- Perlin & Simplex noise methods (used in terrain generation)
|
||||||
|
|
|
@ -3,7 +3,7 @@ minecraft_version=1.19.1
|
||||||
yarn_mappings=build.1
|
yarn_mappings=build.1
|
||||||
loader_version=0.14.8
|
loader_version=0.14.8
|
||||||
maven_group=io.jfronny.gitlab
|
maven_group=io.jfronny.gitlab
|
||||||
archives_base_name=quickmeth
|
archives_base_name=quickmath
|
||||||
|
|
||||||
fabric_version=0.58.5+1.19.1
|
fabric_version=0.58.5+1.19.1
|
||||||
jfapi_version=2.10.0
|
jfapi_version=2.10.0
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package io.gitlab.jfronny.quickmeth;
|
package io.gitlab.jfronny.quickmath;
|
||||||
|
|
||||||
import io.gitlab.jfronny.libjf.unsafe.asm.AsmConfig;
|
import io.gitlab.jfronny.libjf.unsafe.asm.AsmConfig;
|
||||||
import io.gitlab.jfronny.libjf.unsafe.asm.AsmTransformer;
|
import io.gitlab.jfronny.libjf.unsafe.asm.AsmTransformer;
|
||||||
|
@ -13,19 +13,19 @@ import java.util.Set;
|
||||||
public class BytecodeTransformer implements AsmConfig {
|
public class BytecodeTransformer implements AsmConfig {
|
||||||
private static final String math = "java/lang/Math";
|
private static final String math = "java/lang/Math";
|
||||||
private static final String random = "java/util/Random";
|
private static final String random = "java/util/Random";
|
||||||
private static final String mathUtil = "io/gitlab/jfronny/quickmeth/MathUtil";
|
private static final String mathUtil = "io/gitlab/jfronny/quickmath/MathUtil";
|
||||||
private static final String mathHelperIntermediary = "net.minecraft.class_3532";
|
private static final String mathHelperIntermediary = "net.minecraft.class_3532";
|
||||||
private static final String mathHelper = PatchUtil.getRemappedInternal(mathHelperIntermediary);
|
private static final String mathHelper = PatchUtil.getRemappedInternal(mathHelperIntermediary);
|
||||||
private static final String mojangRandomIntermediary = "net.minecraft.class_5819";
|
private static final String mojangRandomIntermediary = "net.minecraft.class_5819";
|
||||||
private static final String mojangRandom = PatchUtil.getRemappedInternal(mojangRandomIntermediary);
|
private static final String mojangRandom = PatchUtil.getRemappedInternal(mojangRandomIntermediary);
|
||||||
private static final String mathHelperRandomUuid = mth("method_15378", "(Lnet/minecraft/class_5819;)Ljava/util/UUID;");
|
private static final String mathHelperRandomUuid = mth("method_15378", "(Lnet/minecraft/class_5819;)Ljava/util/UUID;");
|
||||||
private static final Map<String, String> mth = DMap.of( // Maps methods in mathHelper to quickmeth MathUtil methods
|
private static final Map<String, String> mth = DMap.of( // Maps methods in mathHelper to QuickMäth MathUtil methods
|
||||||
mth("method_15374", "(F)F"), "sinM",
|
mth("method_15374", "(F)F"), "sinM",
|
||||||
mth("method_15362", "(F)F"), "cosM",
|
mth("method_15362", "(F)F"), "cosM",
|
||||||
mth("method_15355", "(F)F"), "sqrtM",
|
mth("method_15355", "(F)F"), "sqrtM",
|
||||||
mth("method_15375", "(D)I"), "floor"
|
mth("method_15375", "(D)I"), "floor"
|
||||||
);
|
);
|
||||||
private static final Map<String, String> rnd = DMap.of( // Maps methods in minecrafts Random to quickmeth MathUtil methods
|
private static final Map<String, String> rnd = DMap.of( // Maps methods in Minecraft Random to QuickMäth MathUtil methods
|
||||||
rnd("method_43054", "()I"), "nextInt",
|
rnd("method_43054", "()I"), "nextInt",
|
||||||
rnd("method_43048", "(I)I"), "nextInt",
|
rnd("method_43048", "(I)I"), "nextInt",
|
||||||
rnd("method_43055", "()J"), "nextLong",
|
rnd("method_43055", "()J"), "nextLong",
|
||||||
|
@ -34,7 +34,7 @@ public class BytecodeTransformer implements AsmConfig {
|
||||||
rnd("method_43058", "()D"), "random",
|
rnd("method_43058", "()D"), "random",
|
||||||
rnd("method_43059", "()D"), "random"
|
rnd("method_43059", "()D"), "random"
|
||||||
);
|
);
|
||||||
private static final Map<String, Boolean> stat = Map.of( // Maps quickmeth MathUtil methods to booleans representing whether to overwrite them
|
private static final Map<String, Boolean> stat = Map.of( // Maps QuickMäth MathUtil methods to booleans representing whether to overwrite them
|
||||||
"sin", Cfg.corruptTrigonometry2,
|
"sin", Cfg.corruptTrigonometry2,
|
||||||
"cos", Cfg.corruptTrigonometry2,
|
"cos", Cfg.corruptTrigonometry2,
|
||||||
"sinM", Cfg.corruptTrigonometry,
|
"sinM", Cfg.corruptTrigonometry,
|
||||||
|
@ -79,7 +79,7 @@ public class BytecodeTransformer implements AsmConfig {
|
||||||
if (insn.getOpcode() == Opcodes.INVOKESTATIC || insn.getOpcode() == Opcodes.INVOKEVIRTUAL || insn.getOpcode() == Opcodes.INVOKEINTERFACE) {
|
if (insn.getOpcode() == Opcodes.INVOKESTATIC || insn.getOpcode() == Opcodes.INVOKEVIRTUAL || insn.getOpcode() == Opcodes.INVOKEINTERFACE) {
|
||||||
String insNew = null;
|
String insNew = null;
|
||||||
MethodInsnNode mIns = (MethodInsnNode) insn;
|
MethodInsnNode mIns = (MethodInsnNode) insn;
|
||||||
// Resolve a possible replacement method in quickmeth MathUtil
|
// Resolve a possible replacement method in QuickMäth MathUtil
|
||||||
if (mIns.owner.equals(math)) {
|
if (mIns.owner.equals(math)) {
|
||||||
if (stat.containsKey(mIns.name))
|
if (stat.containsKey(mIns.name))
|
||||||
insNew = mIns.name;
|
insNew = mIns.name;
|
|
@ -1,4 +1,4 @@
|
||||||
package io.gitlab.jfronny.quickmeth;
|
package io.gitlab.jfronny.quickmath;
|
||||||
|
|
||||||
import io.gitlab.jfronny.libjf.config.api.Entry;
|
import io.gitlab.jfronny.libjf.config.api.Entry;
|
||||||
import io.gitlab.jfronny.libjf.config.api.JfConfig;
|
import io.gitlab.jfronny.libjf.config.api.JfConfig;
|
|
@ -1,4 +1,4 @@
|
||||||
package io.gitlab.jfronny.quickmeth;
|
package io.gitlab.jfronny.quickmath;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package io.gitlab.jfronny.quickmeth;
|
package io.gitlab.jfronny.quickmath;
|
||||||
|
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package io.gitlab.jfronny.quickmeth;
|
package io.gitlab.jfronny.quickmath;
|
||||||
|
|
||||||
import io.gitlab.jfronny.quickmeth.mixin.*;
|
import io.gitlab.jfronny.quickmath.mixin.*;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
|
@ -1,4 +1,4 @@
|
||||||
package io.gitlab.jfronny.quickmeth;
|
package io.gitlab.jfronny.quickmath;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.log.*;
|
import io.gitlab.jfronny.commons.log.*;
|
||||||
import net.fabricmc.api.*;
|
import net.fabricmc.api.*;
|
|
@ -1,6 +1,6 @@
|
||||||
package io.gitlab.jfronny.quickmeth.mixin;
|
package io.gitlab.jfronny.quickmath.mixin;
|
||||||
|
|
||||||
import io.gitlab.jfronny.quickmeth.MathUtil;
|
import io.gitlab.jfronny.quickmath.MathUtil;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.random.*;
|
import net.minecraft.util.math.random.*;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
|
@ -1,6 +1,6 @@
|
||||||
package io.gitlab.jfronny.quickmeth.mixin;
|
package io.gitlab.jfronny.quickmath.mixin;
|
||||||
|
|
||||||
import io.gitlab.jfronny.quickmeth.MathUtil;
|
import io.gitlab.jfronny.quickmath.MathUtil;
|
||||||
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.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
|
@ -1,6 +1,6 @@
|
||||||
package io.gitlab.jfronny.quickmeth.mixin;
|
package io.gitlab.jfronny.quickmath.mixin;
|
||||||
|
|
||||||
import io.gitlab.jfronny.quickmeth.MathUtil;
|
import io.gitlab.jfronny.quickmath.MathUtil;
|
||||||
import net.minecraft.util.math.noise.PerlinNoiseSampler;
|
import net.minecraft.util.math.noise.PerlinNoiseSampler;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
|
@ -1,6 +1,6 @@
|
||||||
package io.gitlab.jfronny.quickmeth.mixin;
|
package io.gitlab.jfronny.quickmath.mixin;
|
||||||
|
|
||||||
import io.gitlab.jfronny.quickmeth.MathUtil;
|
import io.gitlab.jfronny.quickmath.MathUtil;
|
||||||
import net.minecraft.util.math.noise.SimplexNoiseSampler;
|
import net.minecraft.util.math.noise.SimplexNoiseSampler;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"quickmath.jfconfig.title": "QuickMäth - 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"
|
||||||
|
}
|
|
@ -1,17 +0,0 @@
|
||||||
{
|
|
||||||
"quickmeth.jfconfig.title": "QuickMäth - Restart to apply changes",
|
|
||||||
"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.corruptGenericMath2": "Corrupt more generic math",
|
|
||||||
"quickmeth.jfconfig.corruptGenericMath2.tooltip": "Corrupts more methods in MathHelper. These WILL break a lot of things so they are separate",
|
|
||||||
"quickmeth.jfconfig.corruptTrigonometry": "Corrupt Trigonometry",
|
|
||||||
"quickmeth.jfconfig.corruptTrigonometry.tooltip": "Corrupts trigonometry methods. Effects vary",
|
|
||||||
"quickmeth.jfconfig.corruptTrigonometry2": "Corrupt more Trigonometry",
|
|
||||||
"quickmeth.jfconfig.corruptTrigonometry2.tooltip": "Corrupts all trigonometry methods. This WILL break a lot of things",
|
|
||||||
"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",
|
|
||||||
"quickmeth.jfconfig.debugAsm": "Debug ASM",
|
|
||||||
"quickmeth.jfconfig.debugAsm.tooltip": "Prints debug messages for the purpose of debugging"
|
|
||||||
}
|
|
|
@ -1,32 +1,33 @@
|
||||||
{
|
{
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"id": "quickmeth",
|
"id": "quickmath",
|
||||||
|
"provides": ["quickmeth"],
|
||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
"name": "Quickmeth",
|
"name": "QuickMäth",
|
||||||
"description": "Replaces math methods with incorrect alternatives",
|
"description": "Replaces math methods with incorrect alternatives",
|
||||||
"authors": [
|
"authors": [
|
||||||
"JFronny"
|
"JFronny"
|
||||||
],
|
],
|
||||||
"contact": {
|
"contact": {
|
||||||
"website": "https://jfronny.gitlab.io",
|
"website": "https://jfronny.gitlab.io",
|
||||||
"repo": "https://gitlab.com/jfmods/Quickmeth"
|
"repo": "https://gitlab.com/jfmods/quickmath"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"icon": "assets/quickmeth/icon.png",
|
"icon": "assets/quickmath/icon.png",
|
||||||
"environment": "*",
|
"environment": "*",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"libjf:config": [
|
"libjf:config": [
|
||||||
"io.gitlab.jfronny.quickmeth.Cfg"
|
"io.gitlab.jfronny.quickmath.Cfg"
|
||||||
],
|
],
|
||||||
"libjf:asm": [
|
"libjf:asm": [
|
||||||
"io.gitlab.jfronny.quickmeth.BytecodeTransformer"
|
"io.gitlab.jfronny.quickmath.BytecodeTransformer"
|
||||||
],
|
],
|
||||||
"main": [
|
"main": [
|
||||||
"io.gitlab.jfronny.quickmeth.ModMain"
|
"io.gitlab.jfronny.quickmath.ModMain"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"quickmeth.mixins.json"
|
"quickmath.mixins.json"
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.13.3",
|
"fabricloader": ">=0.13.3",
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"required": true,
|
"required": true,
|
||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "io.gitlab.jfronny.quickmeth.mixin",
|
"package": "io.gitlab.jfronny.quickmath.mixin",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"plugin": "io.gitlab.jfronny.quickmeth.MixinPlugin",
|
"plugin": "io.gitlab.jfronny.quickmath.MixinPlugin",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"MathHelperMixin",
|
"MathHelperMixin",
|
||||||
"MathHelperMixin2",
|
"MathHelperMixin2",
|
Loading…
Reference in New Issue