Package org.cloudburstmc.mojava.compiler
Interface MoScript
public interface MoScript
A compiled Molang program. The generated class implements this; its
evaluate(org.cloudburstmc.mojava.runtime.MoScope, org.cloudburstmc.mojava.runtime.MoEnvironment) mirrors the
top-level evaluation loop of MoRuntime.execute(List) (final return value or last
expression result). The surrounding lifecycle — scope creation, temp clearing, context add/remove
— stays owned by MoRuntime.-
Method Summary
Modifier and TypeMethodDescriptionevaluate(MoScope scope, MoEnvironment environment) default doubleevaluateDouble(MoScope scope, MoEnvironment environment) Primitive-double result path.default booleanFalse when the program contains noreturn/break/continue/loop, so it never reads or writes the scope.
-
Method Details
-
evaluate
-
evaluateDouble
Primitive-double result path. The generated class overrides this with an unboxed body when the whole program is statically numeric and free of control flow, so a number-consuming caller (the common animation/particle case) never allocates the terminalDoubleValue. The default delegates toevaluate(org.cloudburstmc.mojava.runtime.MoScope, org.cloudburstmc.mojava.runtime.MoEnvironment)and unboxes, so every script still answers correctly. -
usesScope
default boolean usesScope()False when the program contains noreturn/break/continue/loop, so it never reads or writes the scope.MoRuntimethen skips allocating a per-evalMoScopeand passes the shared sentinel instead.
-