Skip to content

Processors

A ProcessorList is a list of StructureProcessors that every block of a template passes through as it is placed.

A processor list is either a reference to a registered list or a list you create. ProcessorList.EMPTY runs no processors.

ExamplePlugin.java Java
import dev.wyck.keys.ResourceKey;
import dev.wyck.worldgen.structure.templatesystem.ProcessorList;
import dev.wyck.worldgen.structure.templatesystem.processor.StructureProcessor;

// A vanilla list
ProcessorList mossy = ProcessorList.reference(ResourceKey.minecraft("mossify_10_percent"));

// A list used only by one element, no registration needed
ProcessorList aged = ProcessorList.of(StructureProcessor.blockAge(0.4F));

// A named list shared between elements
ProcessorList.builder()
  .resourceKey(ResourceKey.of("wyck", "weathered"))
  .processor(StructureProcessor.blockAge(0.4F))
  .processor(StructureProcessor.blockRot(0.9F))
  .build()
  .register();

A ProcessorRule replaces a template block with outputState when all of its tests pass.

ExamplePlugin.java Java
import dev.wyck.worldgen.ruletest.RuleTest;
import dev.wyck.worldgen.structure.templatesystem.processor.ProcessorRule;
import dev.wyck.worldgen.structure.templatesystem.processor.StructureProcessor;
import org.bukkit.Material;

StructureProcessor mossify = StructureProcessor.rule(
  ProcessorRule.builder(RuleTest.randomBlockMatch(Material.COBBLESTONE, 0.1F), Material.MOSSY_COBBLESTONE.createBlockData())
      .build(),
  ProcessorRule.builder(RuleTest.blockMatch(Material.GLASS_PANE), Material.AIR.createBlockData())
      .locationPredicate(RuleTest.blockMatch(Material.WATER))
      .build()
);