MaterialRuleCompiler 5.46.0
Turns a material rule tree into one PHP method (nested ifs, conditions inlined), which the JIT compiles well: evaluating the object tree costs a method call per node and block. Same results as MaterialRule::apply().
Constants
NAMESPACE
public const NAMESPACE = "pocketmine\\world\\generator\\vanilla\\compiled"Methods
bind()
public function bind(mixed $value) : stringIndex of a value in the bindings array of the generated class ($b[index] in the generated code).
create()
public static function create(\pocketmine\world\generator\vanilla\surface\rule\MaterialRule $rule, string $cacheDir) : \pocketmine\world\generator\vanilla\surface\rule\MaterialRuledensity()
public function density(\pocketmine\world\generator\vanilla\density\DensityFunction $f, \pocketmine\world\generator\vanilla\surface\InterpolationCache $cache) : stringPHP expression computing a density function at the block ($x, $y, $z) with the same operations (and float results) as DensityFunction::compute(). Interpolated nodes take their value from the chunk's interpolation cache, once per block; node types without an inline form are called through their compute().
float()
public static function float(float $value) : stringlazy()
public function lazy(string $expression) : stringExpression evaluated at most once per block: a local variable of the generated method, set on first use.
temp()
public function temp() : stringA new temporary variable name for the generated code.
