modules and imports

This commit is contained in:
gnembon committed 2020-01-08 23:38:31 -04:00
1 parent 34bf877bc7
commit 4f65be946c
17 files changed
+479 -314

No files matched your search

@@ -7,6 +7,7 @@ import carpet.helpers.FeatureGenerator;
import carpet.mixins.ChunkTicketManager_scarpetMixin;
import carpet.mixins.ServerChunkManager_scarpetMixin;
import carpet.script.Fluff.TriFunction;
import carpet.script.bundled.Module;
import carpet.script.exception.CarpetExpressionException;
import carpet.script.exception.ExitStatement;
import carpet.script.exception.ExpressionException;
@@ -2135,9 +2136,7 @@ public class CarpetExpression
else if (!(functionValue instanceof FunctionValue))
{
String name = functionValue.getString();
functionValue = c.host.globalFunctions.get(name);
if (functionValue == null)
throw new InternalExpressionException("Function "+name+" is not defined yet");
functionValue = c.host.getAssertFunction(this.expr.module, name);
}
FunctionValue function = (FunctionValue)functionValue;
List<Value> args = null;
@@ -3194,9 +3193,7 @@ public class CarpetExpression
if (!(functionValue instanceof FunctionValue))
{
String name = functionValue.getString();
functionValue = c.host.globalFunctions.get(name);
if (functionValue == null)
throw new InternalExpressionException("Function "+name+" is not defined yet");
functionValue = c.host.getAssertFunction(this.expr.module, name);
}
FunctionValue function = (FunctionValue)functionValue;
@@ -3298,11 +3295,13 @@ public class CarpetExpression
* @param source source
* @param origin origin
*/
public CarpetExpression(String expression, ServerCommandSource source, BlockPos origin)
public CarpetExpression(Module module, String expression, ServerCommandSource source, BlockPos origin)
{
this.origin = origin;
this.source = source;
this.expr = new Expression(expression);
this.expr.asAModule(module);
API_BlockManipulation();
API_EntityManipulation();