mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-19 14:50:30 +00:00
Reformat & add .editorconfig
This commit is contained in:
@@ -8,8 +8,8 @@ import parsii.eval.Function;
|
||||
import java.util.List;
|
||||
|
||||
public class NoiseFunction2 implements Function {
|
||||
private FastNoiseLite gen;
|
||||
private final Cache cache = new Cache();
|
||||
private FastNoiseLite gen;
|
||||
|
||||
@Override
|
||||
public int getNumberOfArguments() {
|
||||
@@ -34,6 +34,7 @@ public class NoiseFunction2 implements Function {
|
||||
private final double[] cacheX = new double[ConfigUtil.cacheSize];
|
||||
private final double[] cacheZ = new double[ConfigUtil.cacheSize];
|
||||
private final double[] cacheValues = new double[ConfigUtil.cacheSize];
|
||||
|
||||
public double get(double x, double z) {
|
||||
for(int i = 0; i < cacheX.length; i++) {
|
||||
if(cacheX[i] == x && cacheZ[i] == z) return cacheValues[i];
|
||||
@@ -41,10 +42,10 @@ public class NoiseFunction2 implements Function {
|
||||
cacheX[0] = x;
|
||||
cacheZ[0] = z;
|
||||
cacheValues[0] = gen.getNoise(x, z);
|
||||
for(int i = 0; i < cacheX.length-1; i++) {
|
||||
cacheX[i+1] = cacheX[i];
|
||||
cacheZ[i+1] = cacheZ[i];
|
||||
cacheValues[i+1] = cacheValues[i];
|
||||
for(int i = 0; i < cacheX.length - 1; i++) {
|
||||
cacheX[i + 1] = cacheX[i];
|
||||
cacheZ[i + 1] = cacheZ[i];
|
||||
cacheValues[i + 1] = cacheValues[i];
|
||||
}
|
||||
return cacheValues[0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user