mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-16 13:51:41 +00:00
fix user defined functions
This commit is contained in:
@@ -354,14 +354,8 @@ public class BiomeTemplate extends AbstractableTemplate implements ValidatedConf
|
||||
Map<String, FunctionTemplate> testFunctions = new LinkedHashMap<>(pack.getTemplate().getFunctions());
|
||||
testFunctions.putAll(functions);
|
||||
for(Map.Entry<String, FunctionTemplate> entry : testFunctions.entrySet()) {
|
||||
String id = entry.getKey();
|
||||
FunctionTemplate fun = entry.getValue();
|
||||
|
||||
Scope functionScope = new Scope().withParent(testScope);
|
||||
fun.getArgs().forEach(functionScope::addInvocationVariable);
|
||||
|
||||
try {
|
||||
tester.registerFunction(id, new UserDefinedFunction(tester.parse(fun.getFunction(), functionScope), fun.getArgs().size()));
|
||||
tester.registerFunction(entry.getKey(), UserDefinedFunction.newInstance(entry.getValue(), tester, testScope));
|
||||
} catch(ParseException e) {
|
||||
throw new ValidationException("Invalid function: ", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user