Boxed invert go brrr
This commit is contained in:
parent
11b09cbfb3
commit
7882f44498
|
@ -1,5 +1,6 @@
|
|||
package io.gitlab.jfronny.quickmeth.mixin;
|
||||
|
||||
import io.gitlab.jfronny.quickmeth.quickmeth;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.util.Util;
|
||||
|
@ -28,11 +29,11 @@ public class MathHelperMixin {
|
|||
|
||||
@Overwrite
|
||||
public static float sin(float f) {
|
||||
return SINE_TABLE[(int)(65536 - f * 10430.378F) & '\uffff'];
|
||||
return quickmeth.BoxedInvert(SINE_TABLE[(int)(f * 10430.378F) & '\uffff']);
|
||||
}
|
||||
|
||||
@Overwrite
|
||||
public static float cos(float f) { return round(1 - sin(f)); }
|
||||
//@Overwrite
|
||||
//public static float cos(float f) { return round(1 - sin(f)); }
|
||||
|
||||
//@Overwrite
|
||||
//public static float sqrt(float f) {
|
||||
|
@ -41,7 +42,7 @@ public class MathHelperMixin {
|
|||
|
||||
@Overwrite
|
||||
public static float sqrt(double d) {
|
||||
return (float)Math.pow(d, -2);
|
||||
return (float)Math.pow(d, 0.6);
|
||||
}
|
||||
|
||||
//@Overwrite
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package io.gitlab.jfronny.quickmeth;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class quickmeth implements ModInitializer {
|
||||
@Override
|
||||
|
@ -13,6 +14,14 @@ public class quickmeth implements ModInitializer {
|
|||
}
|
||||
|
||||
public static double BoxedInvert(double value) {
|
||||
return BoxedInvert(Math.floor(value), Math.ceil(value), value);
|
||||
return BoxedInvert(MathHelper.floor(value), MathHelper.ceil(value), 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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue