This is art
This commit is contained in:
parent
b290eb89b3
commit
817e5a0b9e
|
@ -6,23 +6,28 @@ variables:
|
|||
before_script:
|
||||
- export GRADLE_USER_HOME=`pwd`/.gradle
|
||||
|
||||
stages:
|
||||
- build
|
||||
- deploy
|
||||
|
||||
build_test:
|
||||
stage: deploy
|
||||
stage: build
|
||||
script:
|
||||
- gradle --build-cache assemble
|
||||
- gradle --build-cache build
|
||||
- cp build/libs/* ./
|
||||
- rm *-dev.jar
|
||||
- rm *-maven.jar *-sources.jar *-sources-dev.jar
|
||||
- mv *-dev.jar dev.zip
|
||||
- mv *.jar latest.jar
|
||||
- mv dev.zip latest-dev.jar
|
||||
artifacts:
|
||||
paths:
|
||||
- build/libs
|
||||
- latest.jar
|
||||
only:
|
||||
- master
|
||||
- latest-dev.jar
|
||||
|
||||
deploy:
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG && '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^master/'
|
||||
stage: deploy
|
||||
when: manual
|
||||
script:
|
||||
- gradle --build-cache publishModrinth
|
||||
- gradle --build-cache curseforge
|
||||
- gradle --build-cache build curseforge modrinth
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
# Done to increase the memory available to gradle.
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
# Fabric Properties
|
||||
# check these on https://modmuss50.me/fabric.html
|
||||
# check these on https://fabricmc.net/versions.html
|
||||
minecraft_version=1.17.1
|
||||
yarn_mappings=build.61
|
||||
loader_version=0.12.1
|
||||
# Mod Properties
|
||||
mod_version=1.3.0
|
||||
mod_version=1.4.0
|
||||
maven_group=io.jfronny.gitlab
|
||||
archives_base_name=quickmeth
|
||||
# Dependencies
|
||||
fabric_version=0.40.6+1.17
|
||||
jfapi_version=2.0.1
|
||||
jfapi_version=2.1.1
|
||||
|
||||
modrinth_id=hRVfXPJj
|
||||
modrinth_required_dependencies=
|
||||
|
|
|
@ -3,35 +3,35 @@ package io.gitlab.jfronny.quickmeth;
|
|||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class MathUtil {
|
||||
public static double BoxedInvert(double min, double max, double value) {
|
||||
public static double boxedInvert(double min, double max, double value) {
|
||||
return max - value + min;
|
||||
}
|
||||
|
||||
public static double BoxedInvert(double value) {
|
||||
return BoxedInvert(MathHelper.floor(value), MathHelper.ceil(value), value);
|
||||
public static double boxedInvert(double value) {
|
||||
return boxedInvert(MathHelper.floor(value), MathHelper.ceil(value), value);
|
||||
}
|
||||
|
||||
public static float BoxedInvert(float min, float max, float value) {
|
||||
public static float boxedInvert(float min, float max, float value) {
|
||||
return max - value + min;
|
||||
}
|
||||
|
||||
public static float BoxedInvert(float value) {
|
||||
return BoxedInvert(MathHelper.floor(value), MathHelper.ceil(value), value);
|
||||
public static float boxedInvert(float value) {
|
||||
return boxedInvert(MathHelper.floor(value), MathHelper.ceil(value), value);
|
||||
}
|
||||
|
||||
public static long BoxedInvert(long min, long max, long value) {
|
||||
public static long boxedInvert(long min, long max, long value) {
|
||||
return max - value + min;
|
||||
}
|
||||
|
||||
public static long BoxedInvert(long value) {
|
||||
return BoxedInvert(MathHelper.floor(value), MathHelper.ceil(value), value);
|
||||
public static long boxedInvert(long value) {
|
||||
return boxedInvert(MathHelper.floor(value), MathHelper.ceil(value), value);
|
||||
}
|
||||
|
||||
public static int BoxedInvert(int min, int max, int value) {
|
||||
public static int boxedInvert(int min, int max, int value) {
|
||||
return max - value + min;
|
||||
}
|
||||
|
||||
public static int BoxedInvert(int value) {
|
||||
return BoxedInvert(MathHelper.floor(value), MathHelper.ceil(value), value);
|
||||
public static int boxedInvert(int value) {
|
||||
return boxedInvert(MathHelper.floor(value), MathHelper.ceil(value), value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package io.gitlab.jfronny.quickmeth;
|
||||
|
||||
// https://github.com/FwuffyPetsOwO/FastMathFabric/blob/main/src/main/java/net/FwuffyPetsOwO/FastMath/FastMath.java
|
||||
public class SinUtil {
|
||||
private static final float[] SIN_TABLE_FAST = new float[4096];
|
||||
private static final float radToIndex = roundToFloat(651.8986469044033D);
|
||||
|
||||
static {
|
||||
for (int j = 0; j < SIN_TABLE_FAST.length; ++j) {
|
||||
SIN_TABLE_FAST[j] = roundToFloat(Math.sin((double) j * Math.PI * 2.0D / 4096.0D));
|
||||
}
|
||||
}
|
||||
|
||||
public static float sin(float value) {
|
||||
return SIN_TABLE_FAST[(int) (value * radToIndex) & 4095];
|
||||
}
|
||||
|
||||
public static float roundToFloat(double d) {
|
||||
return (float) ((double) Math.round(d * 1.0E8D) / 1.0E8D);
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package io.gitlab.jfronny.quickmeth.mixin;
|
||||
|
||||
import io.gitlab.jfronny.quickmeth.MathUtil;
|
||||
import io.gitlab.jfronny.quickmeth.SinUtil;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
@ -16,13 +17,17 @@ import java.util.Random;
|
|||
@Mixin(MathHelper.class)
|
||||
public abstract class MathHelperMixin {
|
||||
@Shadow @Final private static Random RANDOM;
|
||||
@Shadow public static float sin(float value) { return 0; }
|
||||
@Shadow public static int floor(double value) { return 0; }
|
||||
@Shadow public static double nextDouble(Random random, double min, double max) { return 0; }
|
||||
|
||||
@Inject(method = "sin(F)F", at = @At("TAIL"), cancellable = true)
|
||||
private static void invertSin(CallbackInfoReturnable<Float> ci) {
|
||||
ci.setReturnValue(MathUtil.BoxedInvert(ci.getReturnValue()));
|
||||
ci.setReturnValue(MathUtil.boxedInvert(ci.getReturnValue()));
|
||||
}
|
||||
|
||||
@Overwrite
|
||||
public static float sin(float f) {
|
||||
return SinUtil.sin(f);
|
||||
}
|
||||
|
||||
@Overwrite
|
||||
|
@ -100,11 +105,11 @@ public abstract class MathHelperMixin {
|
|||
|
||||
@Overwrite
|
||||
public static long clamp(long value, long min, long max) {
|
||||
return MathUtil.BoxedInvert(Math.max(Math.min(value, max), min), max, min);
|
||||
return MathUtil.boxedInvert(Math.max(Math.min(value, max), min), max, min);
|
||||
}
|
||||
|
||||
@Inject(method = "clampedLerp(DDD)D", at = @At("TAIL"), cancellable = true)
|
||||
private static void adjustClampedLerp(double start, double end, double delta, CallbackInfoReturnable<Double> ci) {
|
||||
ci.setReturnValue(MathUtil.BoxedInvert(ci.getReturnValue(), end, start));
|
||||
ci.setReturnValue(MathUtil.boxedInvert(ci.getReturnValue(), end, start));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ public class MathHelperMixin2 {
|
|||
ci.setReturnValue(ci.getReturnValue() / 2 + 1);
|
||||
}
|
||||
|
||||
@Overwrite
|
||||
/*@Overwrite
|
||||
public static float clamp(float value, float min, float max) {
|
||||
return MathUtil.BoxedInvert(Math.max(Math.min(value, max), min), max, min);
|
||||
}
|
||||
return MathUtil.boxedInvert(min, max, Math.max(Math.min(value, max), min));
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -12,33 +12,33 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
public abstract class MixinPerlinNoiseSampler {
|
||||
@ModifyVariable(method = "sample(IIIDDDD)D", at = @At("HEAD"), argsOnly = true, ordinal = 0)
|
||||
private double sampleAdjustX(double localX) {
|
||||
return MathUtil.BoxedInvert(localX);
|
||||
return MathUtil.boxedInvert(localX);
|
||||
}
|
||||
|
||||
@ModifyVariable(method = "sampleDerivative(IIIDDD[D)D", at = @At("HEAD"), argsOnly = true, ordinal = 0)
|
||||
private double derivAdjustX(double localX) {
|
||||
return MathUtil.BoxedInvert(localX);
|
||||
return MathUtil.boxedInvert(localX);
|
||||
}
|
||||
|
||||
//Once again, the y parameter is ignored because mixin
|
||||
|
||||
@ModifyVariable(method = "sample(IIIDDDD)D", at = @At("HEAD"), argsOnly = true, ordinal = 2)
|
||||
private double sampleAdjustZ(double localZ) {
|
||||
return MathUtil.BoxedInvert(localZ);
|
||||
return MathUtil.boxedInvert(localZ);
|
||||
}
|
||||
|
||||
@ModifyVariable(method = "sampleDerivative(IIIDDD[D)D", at = @At("HEAD"), argsOnly = true, ordinal = 2)
|
||||
private double derivAdjustZ(double localZ) {
|
||||
return MathUtil.BoxedInvert(localZ);
|
||||
return MathUtil.boxedInvert(localZ);
|
||||
}
|
||||
|
||||
@Inject(method = "sample(IIIDDDD)D", at = @At("TAIL"), cancellable = true)
|
||||
private void sampleAsjustResult(CallbackInfoReturnable<Double> ret) {
|
||||
ret.setReturnValue(MathUtil.BoxedInvert(ret.getReturnValue()));
|
||||
ret.setReturnValue(MathUtil.boxedInvert(ret.getReturnValue()));
|
||||
}
|
||||
|
||||
@Inject(method = "sampleDerivative(IIIDDD[D)D", at = @At("TAIL"), cancellable = true)
|
||||
private void derivAsjustResult(CallbackInfoReturnable<Double> ret) {
|
||||
ret.setReturnValue(MathUtil.BoxedInvert(ret.getReturnValue()));
|
||||
ret.setReturnValue(MathUtil.boxedInvert(ret.getReturnValue()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,12 +12,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
public abstract class MixinSimplexNoiseSampler {
|
||||
@Inject(method = "sample(DD)D", at = @At("TAIL"), cancellable = true)
|
||||
private void sampleAdjust(CallbackInfoReturnable<Double> ret) {
|
||||
ret.setReturnValue(MathUtil.BoxedInvert(ret.getReturnValue()));
|
||||
ret.setReturnValue(MathUtil.boxedInvert(ret.getReturnValue()));
|
||||
}
|
||||
|
||||
@ModifyVariable(method = "sample(DD)D", at = @At("HEAD"), argsOnly = true, ordinal = 0)
|
||||
private double sampleAdjustX(double x) {
|
||||
return MathUtil.BoxedInvert(x);
|
||||
return MathUtil.boxedInvert(x);
|
||||
}
|
||||
// The y parameter is ignored here because otherwise this will crash. I don't know why.
|
||||
|
||||
|
@ -28,16 +28,16 @@ public abstract class MixinSimplexNoiseSampler {
|
|||
|
||||
@ModifyVariable(method = "grad(IDDDD)D", at = @At("HEAD"), argsOnly = true, ordinal = 0)
|
||||
private double gradAdjustX(double x) {
|
||||
return MathUtil.BoxedInvert(x);
|
||||
return MathUtil.boxedInvert(x);
|
||||
}
|
||||
// The y parameter is ignored here because otherwise this will crash. I don't know why.
|
||||
@ModifyVariable(method = "grad(IDDDD)D", at = @At("HEAD"), argsOnly = true, ordinal = 2)
|
||||
private double gradAdjustZ(double z) {
|
||||
return MathUtil.BoxedInvert(z);
|
||||
return MathUtil.boxedInvert(z);
|
||||
}
|
||||
|
||||
@Inject(method = "dot([IDDD)D", at = @At("TAIL"), cancellable = true)
|
||||
private static void dotAdjust(CallbackInfoReturnable<Double> ret) {
|
||||
ret.setReturnValue(MathUtil.BoxedInvert(ret.getReturnValue()));
|
||||
ret.setReturnValue(MathUtil.boxedInvert(ret.getReturnValue()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue