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 Type
    Method
    Description
    evaluate(MoScope scope, MoEnvironment environment)
     
    default double
    evaluateDouble(MoScope scope, MoEnvironment environment)
    Primitive-double result path.
    default boolean
    False when the program contains no return/break/continue/loop, so it never reads or writes the scope.
  • Method Details

    • evaluate

      MoValue evaluate(MoScope scope, MoEnvironment environment)
    • evaluateDouble

      default double evaluateDouble(MoScope scope, MoEnvironment environment)
      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 terminal DoubleValue. The default delegates to evaluate(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 no return/break/continue/loop, so it never reads or writes the scope. MoRuntime then skips allocating a per-eval MoScope and passes the shared sentinel instead.