mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 14:21:08 +00:00
Remove FastMath
hotspot has intrinsics for almost everything we use it for
This commit is contained in:
@@ -2,11 +2,4 @@ version = version("1.1.0")
|
||||
|
||||
dependencies {
|
||||
compileOnlyApi(project(":common:addons:manifest-addon-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.addons.feature.locator.lib.jafama")
|
||||
}
|
||||
}
|
||||
+2
-4
@@ -7,8 +7,6 @@
|
||||
|
||||
package com.dfsek.terra.addons.feature.locator.locators;
|
||||
|
||||
import net.jafama.FastMath;
|
||||
|
||||
import com.dfsek.terra.addons.feature.locator.patterns.Pattern;
|
||||
import com.dfsek.terra.api.structure.feature.BinaryColumn;
|
||||
import com.dfsek.terra.api.structure.feature.Locator;
|
||||
@@ -27,8 +25,8 @@ public class PatternLocator implements Locator {
|
||||
|
||||
@Override
|
||||
public BinaryColumn getSuitableCoordinates(Column<?> column) {
|
||||
int min = FastMath.max(column.getMinY(), search.getMin());
|
||||
int max = FastMath.min(column.getMaxY(), search.getMax());
|
||||
int min = Math.max(column.getMinY(), search.getMin());
|
||||
int max = Math.min(column.getMaxY(), search.getMax());
|
||||
if(min >= max) return BinaryColumn.getNull();
|
||||
return new BinaryColumn(min, max, y -> pattern.matches(y, column));
|
||||
}
|
||||
|
||||
+2
-4
@@ -7,8 +7,6 @@
|
||||
|
||||
package com.dfsek.terra.addons.feature.locator.locators;
|
||||
|
||||
import net.jafama.FastMath;
|
||||
|
||||
import com.dfsek.terra.api.structure.feature.BinaryColumn;
|
||||
import com.dfsek.terra.api.structure.feature.Locator;
|
||||
import com.dfsek.terra.api.util.Range;
|
||||
@@ -26,8 +24,8 @@ public class SurfaceLocator implements Locator {
|
||||
@Override
|
||||
public BinaryColumn getSuitableCoordinates(Column<?> column) {
|
||||
BinaryColumnBuilder builder = column.newBinaryColumn();
|
||||
int max = FastMath.min(search.getMax(), column.getMaxY());
|
||||
int min = FastMath.max(search.getMin(), column.getMinY());
|
||||
int max = Math.min(search.getMax(), column.getMaxY());
|
||||
int min = Math.max(search.getMin(), column.getMinY());
|
||||
if(min >= max) return builder.build();
|
||||
for(int y = min; y < max; y++) {
|
||||
if(column.getBlock(y).isAir() && !column.getBlock(y - 1).isAir()) {
|
||||
|
||||
+4
-6
@@ -7,8 +7,6 @@
|
||||
|
||||
package com.dfsek.terra.addons.feature.locator.patterns;
|
||||
|
||||
import net.jafama.FastMath;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.dfsek.terra.api.block.state.BlockState;
|
||||
@@ -28,8 +26,8 @@ public class MatchPattern implements Pattern {
|
||||
|
||||
@Override
|
||||
public boolean matches(int y, Column<?> column) {
|
||||
int min = FastMath.max(column.getMinY(), range.getMin() + y);
|
||||
int max = FastMath.min(column.getMaxY(), range.getMax() + y);
|
||||
int min = Math.max(column.getMinY(), range.getMin() + y);
|
||||
int max = Math.min(column.getMaxY(), range.getMax() + y);
|
||||
if(max <= min) return false;
|
||||
for(int i = min; i < max; i++) {
|
||||
if(!matches.test(column.getBlock(i))) return false;
|
||||
@@ -39,8 +37,8 @@ public class MatchPattern implements Pattern {
|
||||
|
||||
@Override
|
||||
public boolean matches(WritableWorld world, int x, int y, int z) {
|
||||
int min = FastMath.max(world.getMinHeight(), range.getMin() + y);
|
||||
int max = FastMath.min(world.getMaxHeight(), range.getMax() + y);
|
||||
int min = Math.max(world.getMinHeight(), range.getMin() + y);
|
||||
int max = Math.min(world.getMaxHeight(), range.getMax() + y);
|
||||
if(max <= min) return false;
|
||||
for(int i = min; i < max; i++) {
|
||||
if(!matches.test(world.getBlockState(x, i, z))) return false;
|
||||
|
||||
Reference in New Issue
Block a user