mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-22 08:10:40 +00:00
reformat all code
This commit is contained in:
@@ -23,11 +23,10 @@ import com.dfsek.terra.addons.noise.config.templates.FunctionTemplate;
|
||||
|
||||
|
||||
public class UserDefinedFunction implements DynamicFunction {
|
||||
private static final Map<FunctionTemplate, UserDefinedFunction> CACHE = new HashMap<>();
|
||||
private final Expression expression;
|
||||
private final int args;
|
||||
|
||||
private static final Map<FunctionTemplate, UserDefinedFunction> CACHE = new HashMap<>();
|
||||
|
||||
protected UserDefinedFunction(Expression expression, int args) {
|
||||
this.expression = expression;
|
||||
this.args = args;
|
||||
@@ -38,17 +37,17 @@ public class UserDefinedFunction implements DynamicFunction {
|
||||
if(function == null) {
|
||||
Parser parser = new Parser();
|
||||
Scope parent = new Scope();
|
||||
|
||||
|
||||
Scope functionScope = new Scope().withParent(parent);
|
||||
|
||||
|
||||
template.getArgs().forEach(functionScope::addInvocationVariable);
|
||||
|
||||
|
||||
for(Entry<String, FunctionTemplate> entry : template.getFunctions().entrySet()) {
|
||||
String id = entry.getKey();
|
||||
FunctionTemplate nest = entry.getValue();
|
||||
parser.registerFunction(id, newInstance(nest));
|
||||
}
|
||||
|
||||
|
||||
function = new UserDefinedFunction(parser.parse(template.getFunction(), functionScope), template.getArgs().size());
|
||||
CACHE.put(template, function);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user