Remove FastMath

hotspot has intrinsics for almost everything we use it for
This commit is contained in:
Zoë Gidiere
2023-10-26 10:25:39 -06:00
parent 805f99f57a
commit 9292d3de17
153 changed files with 517 additions and 771 deletions
@@ -4,11 +4,4 @@ dependencies {
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
compileOnlyApi(project(":common:addons:chunk-generator-noise-3d"))
compileOnlyApi(project(":common:addons:structure-terrascript-loader"))
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
}
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
relocate("net.jafama", "com.dfsek.terra.addon.terrascript.check.lib.jafama")
}
}
@@ -7,8 +7,6 @@
package com.dfsek.terra.addon.terrascript.check;
import net.jafama.FastMath;
import com.dfsek.terra.addons.chunkgenerator.generation.NoiseChunkGenerator3D;
import com.dfsek.terra.addons.chunkgenerator.generation.math.samplers.SamplerProvider;
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
@@ -49,8 +47,8 @@ public class CheckFunction implements Function<String> {
RotationUtil.rotateVector(xz, arguments.getRotation());
Vector3 location = arguments.getOrigin().toVector3Mutable().add(
Vector3.of(FastMath.roundToInt(xz.getX()), y.apply(implementationArguments, scope).doubleValue(),
FastMath.roundToInt(xz.getZ()))).immutable();
Vector3.of((int) Math.round(xz.getX()), y.apply(implementationArguments, scope).doubleValue(),
(int) Math.round(xz.getZ()))).immutable();
return apply(location, arguments.getWorld());
}
@@ -82,8 +80,8 @@ public class CheckFunction implements Function<String> {
}
private double sample(double x, double y, double z, SamplerProvider cache, World world) {
int cx = FastMath.floorDiv((int) x, 16);
int cz = FastMath.floorDiv((int) z, 16);
int cx = Math.floorDiv((int) x, 16);
int cz = Math.floorDiv((int) z, 16);
return cache.getChunk(cx, cz, world, world.getBiomeProvider()).sample(x - (cx << 4), y, z - (cz << 4));
}
}