Class RuleProcessor
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
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<RuleProcessor> TheMapCodecfor serializing and deserializing aRuleProcessorfrom JSON. -
Constructor Summary
ConstructorsConstructorDescriptionRuleProcessor(List<OverhauledRule> rules) Constructs a newRuleProcessorwith the given rules. -
Method Summary
Modifier and TypeMethodDescriptionprotected @NotNull net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorType<?> getType()Retrieves the registeredStructureProcessorTypefor this processor.net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfoprocessBlock(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 eachOverhauledRulein order against the current block.Methods inherited from class net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessor
finalizeProcessing
-
Field Details
-
CODEC
TheMapCodecfor serializing and deserializing aRuleProcessorfrom JSON.
-
-
Constructor Details
-
RuleProcessor
Constructs a newRuleProcessorwith the given rules.- Parameters:
rules- The list ofOverhauledRuleinstances 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 eachOverhauledRulein order against the current block. The first matching rule whose probability check succeeds determines the outputBlockState, optionally copying compatible block state properties fromblockInfoOut.state().- Overrides:
processBlockin classnet.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, orblockInfoOutif no rule matched.
-
getType
@NotNull protected @NotNull net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorType<?> getType()Retrieves the registeredStructureProcessorTypefor this processor.- Specified by:
getTypein classnet.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessor- Returns:
StructureProcessors.RULE.
-