Reformat & add .editorconfig

This commit is contained in:
dfsek
2020-11-06 15:21:42 -07:00
parent bfa55fdb5d
commit 4f40550465
33 changed files with 527 additions and 280 deletions

View File

@@ -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];
}