java.lang.Object
net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessor
johnsmith.enchantingoverhauled.api.structure.processor.RuleProcessor

public class RuleProcessor extends net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessor
An enhanced rule-based StructureProcessor that evaluates a list of OverhauledRules.

Improves upon vanilla's RuleProcessor by seeding the per-block RandomSource using the actual transformed world block position (blockInfoOut.pos()) rather than the structure pivot, supporting property copying (such as stair facing/half or slab type), and supporting constant, weighted, and spatial gradient outputs.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.MapCodec<RuleProcessor>
    The MapCodec for serializing and deserializing a RuleProcessor from JSON.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new RuleProcessor with the given rules.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected @NotNull net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorType<?>
    Retrieves the registered StructureProcessorType for this processor.
    net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo
    processBlock(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos offset, net.minecraft.core.BlockPos pivot, net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo blockInfoIn, net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo blockInfoOut, net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings settings)
    Evaluates each OverhauledRule in order against the current block.

    Methods inherited from class net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessor

    finalizeProcessing

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CODEC

      public static final com.mojang.serialization.MapCodec<RuleProcessor> CODEC
      The MapCodec for serializing and deserializing a RuleProcessor from JSON.
  • Constructor Details

    • RuleProcessor

      public RuleProcessor(List<OverhauledRule> rules)
      Constructs a new RuleProcessor with the given rules.
      Parameters:
      rules - The list of OverhauledRule instances to evaluate.
  • Method Details

    • processBlock

      @Nullable public net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo processBlock(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos offset, net.minecraft.core.BlockPos pivot, net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo blockInfoIn, net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo blockInfoOut, net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings settings)
      Evaluates each OverhauledRule in order against the current block. The first matching rule whose probability check succeeds determines the output BlockState, optionally copying compatible block state properties from blockInfoOut.state().
      Overrides:
      processBlock in class net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessor
      Parameters:
      level - The level reader.
      offset - The template offset position.
      pivot - The structure pivot position.
      blockInfoIn - The unrotated original block info from the template (local coordinates).
      blockInfoOut - The transformed block info in world coordinates (absolute coordinates).
      settings - The structure placement settings.
      Returns:
      The modified StructureTemplate.StructureBlockInfo, or blockInfoOut if no rule matched.
    • getType

      @NotNull protected @NotNull net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorType<?> getType()
      Retrieves the registered StructureProcessorType for this processor.
      Specified by:
      getType in class net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessor
      Returns:
      StructureProcessors.RULE.