More refactoring

This commit is contained in:
Astrash
2023-07-23 17:55:29 +10:00
parent f3d1751c87
commit 76728fe593
61 changed files with 317 additions and 301 deletions

View File

@@ -32,16 +32,16 @@ public class ConstantSamplerFunction implements Function<Number> {
}
@Override
public Number invoke(ImplementationArguments implementationArguments, Scope scope) {
public Number evaluate(ImplementationArguments implementationArguments, Scope scope) {
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
double x = this.x.invoke(implementationArguments, scope).doubleValue();
double x = this.x.evaluate(implementationArguments, scope).doubleValue();
double z = this.z.invoke(implementationArguments, scope).doubleValue();
double z = this.z.evaluate(implementationArguments, scope).doubleValue();
if(twoD) {
return sampler.noise(arguments.getWorld().getSeed(), x, z);
} else {
double y = this.y.invoke(implementationArguments, scope).doubleValue();
double y = this.y.evaluate(implementationArguments, scope).doubleValue();
return sampler.noise(arguments.getWorld().getSeed(), x, y, z);
}
}

View File

@@ -37,17 +37,17 @@ public class SamplerFunction implements Function<Number> {
}
@Override
public Number invoke(ImplementationArguments implementationArguments, Scope scope) {
public Number evaluate(ImplementationArguments implementationArguments, Scope scope) {
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
double x = this.x.invoke(implementationArguments, scope).doubleValue();
double x = this.x.evaluate(implementationArguments, scope).doubleValue();
double z = this.z.invoke(implementationArguments, scope).doubleValue();
double z = this.z.evaluate(implementationArguments, scope).doubleValue();
NoiseSampler sampler = samplerFunction.apply(() -> function.invoke(implementationArguments, scope));
NoiseSampler sampler = samplerFunction.apply(() -> function.evaluate(implementationArguments, scope));
if(twoD) {
return sampler.noise(arguments.getWorld().getSeed(), x, z);
} else {
double y = this.y.invoke(implementationArguments, scope).doubleValue();
double y = this.y.evaluate(implementationArguments, scope).doubleValue();
return sampler.noise(arguments.getWorld().getSeed(), x, y, z);
}
}