Use quickmath as the mod id for consistency

This commit is contained in:
Johannes Frohnmeyer 2022-08-21 16:22:54 +02:00
parent c80a2105e3
commit 3fdfc097cb
Signed by: Johannes
GPG Key ID: E76429612C2929F4
17 changed files with 50 additions and 49 deletions

View File

@ -1,4 +1,4 @@
Quickmeth allows you to break math methods in minecraft by enabling replacements for:
Quickth allows you to break math methods in minecraft by enabling replacements for:
- The standard math methods (used almost everywhere where math is needed)
- Trigonometry (which is also used across the codebase and affect things like rendering)
- Perlin & Simplex noise methods (used in terrain generation)

View File

@ -3,7 +3,7 @@ minecraft_version=1.19.1
yarn_mappings=build.1
loader_version=0.14.8
maven_group=io.jfronny.gitlab
archives_base_name=quickmeth
archives_base_name=quickmath
fabric_version=0.58.5+1.19.1
jfapi_version=2.10.0

View File

@ -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.AsmTransformer;
@ -13,19 +13,19 @@ import java.util.Set;
public class BytecodeTransformer implements AsmConfig {
private static final String math = "java/lang/Math";
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 mathHelper = PatchUtil.getRemappedInternal(mathHelperIntermediary);
private static final String mojangRandomIntermediary = "net.minecraft.class_5819";
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 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_15362", "(F)F"), "cosM",
mth("method_15355", "(F)F"), "sqrtM",
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_43048", "(I)I"), "nextInt",
rnd("method_43055", "()J"), "nextLong",
@ -34,7 +34,7 @@ public class BytecodeTransformer implements AsmConfig {
rnd("method_43058", "()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,
"cos", Cfg.corruptTrigonometry2,
"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) {
String insNew = null;
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 (stat.containsKey(mIns.name))
insNew = mIns.name;

View File

@ -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.JfConfig;

View File

@ -1,4 +1,4 @@
package io.gitlab.jfronny.quickmeth;
package io.gitlab.jfronny.quickmath;
import java.util.*;

View File

@ -1,4 +1,4 @@
package io.gitlab.jfronny.quickmeth;
package io.gitlab.jfronny.quickmath;
import net.minecraft.util.math.MathHelper;

View File

@ -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.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;

View File

@ -1,4 +1,4 @@
package io.gitlab.jfronny.quickmeth;
package io.gitlab.jfronny.quickmath;
import io.gitlab.jfronny.commons.log.*;
import net.fabricmc.api.*;

View File

@ -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.random.*;
import org.spongepowered.asm.mixin.Final;

View File

@ -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 org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

View File

@ -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 org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

View File

@ -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 org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -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"
}

View File

@ -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"
}

View File

@ -1,32 +1,33 @@
{
"schemaVersion": 1,
"id": "quickmeth",
"id": "quickmath",
"provides": ["quickmeth"],
"version": "${version}",
"name": "Quickmeth",
"name": "Quickth",
"description": "Replaces math methods with incorrect alternatives",
"authors": [
"JFronny"
],
"contact": {
"website": "https://jfronny.gitlab.io",
"repo": "https://gitlab.com/jfmods/Quickmeth"
"repo": "https://gitlab.com/jfmods/quickmath"
},
"license": "MIT",
"icon": "assets/quickmeth/icon.png",
"icon": "assets/quickmath/icon.png",
"environment": "*",
"entrypoints": {
"libjf:config": [
"io.gitlab.jfronny.quickmeth.Cfg"
"io.gitlab.jfronny.quickmath.Cfg"
],
"libjf:asm": [
"io.gitlab.jfronny.quickmeth.BytecodeTransformer"
"io.gitlab.jfronny.quickmath.BytecodeTransformer"
],
"main": [
"io.gitlab.jfronny.quickmeth.ModMain"
"io.gitlab.jfronny.quickmath.ModMain"
]
},
"mixins": [
"quickmeth.mixins.json"
"quickmath.mixins.json"
],
"depends": {
"fabricloader": ">=0.13.3",

View File

@ -1,9 +1,9 @@
{
"required": true,
"minVersion": "0.8",
"package": "io.gitlab.jfronny.quickmeth.mixin",
"package": "io.gitlab.jfronny.quickmath.mixin",
"compatibilityLevel": "JAVA_17",
"plugin": "io.gitlab.jfronny.quickmeth.MixinPlugin",
"plugin": "io.gitlab.jfronny.quickmath.MixinPlugin",
"mixins": [
"MathHelperMixin",
"MathHelperMixin2",