Skip to main content
Custom structure types extend Minecraft’s structure generation system with additional functionality.

Overview

The More RPG Library provides the ConditionalJigsawStructure type, which extends the standard jigsaw structure with mod dependency checking. This allows structures to only generate when specific mods are loaded.

ConditionalJigsawStructure

Registry ID: more_rpg_classes:conditional_jigsaw
Source: net.more_rpg_classes.worldgen.structure.ConditionalJigsawStructure

Description

A jigsaw-based structure that only generates when a specified mod is loaded. This is particularly useful for add-on mods that want to add structures that depend on specific mod content.

Configuration

{
  "type": "more_rpg_classes:conditional_jigsaw",
  "mod_id": "example_mod",
  "start_pool": "example_mod:village/plains/town_centers",
  "start_jigsaw_name": "minecraft:bottom",
  "size": 7,
  "start_height": {
    "absolute": 0
  },
  "use_expansion_hack": false,
  "project_start_to_heightmap": "WORLD_SURFACE_WG",
  "max_distance_from_center": 80,
  "dimension_padding": {
    "bottom": 0,
    "top": 0
  },
  "liquid_settings": "APPLY_WATERLOGGING"
}

Parameters

ParameterTypeRequiredDefaultDescription
typeStringYes-Must be "more_rpg_classes:conditional_jigsaw"
mod_idStringYes-Mod ID that must be loaded for structure to generate
start_poolStringYes-Registry ID of the starting structure pool
start_jigsaw_nameStringNo-Name of the jigsaw block to start from
sizeIntegerYes-Maximum depth of jigsaw generation (0-128)
start_heightHeightProviderYes-Height provider for structure placement
use_expansion_hackBooleanNofalseWhether to use the expansion hack for better terrain adaptation
project_start_to_heightmapStringNo-Heightmap type to project start position to (e.g., "WORLD_SURFACE_WG")
max_distance_from_centerIntegerYes-Maximum distance pieces can generate from center (1-128)
dimension_paddingObjectNoNONEPadding to prevent structures from generating near dimension boundaries
liquid_settingsStringNo"IGNORE_WATERLOGGING"How to handle water ("IGNORE_WATERLOGGING" or "APPLY_WATERLOGGING")

How It Works

  1. Mod Check: When the structure attempts to generate, it checks if the specified mod_id is loaded using Fabric Loader
  2. Early Exit: If the mod is not loaded, returns Optional.empty(), preventing generation
  3. Standard Generation: If the mod is loaded, proceeds with standard jigsaw structure generation

Height Providers

The start_height parameter accepts various height providers:

Absolute Height

"start_height": {
  "absolute": 64
}

Uniform Range

"start_height": {
  "type": "minecraft:uniform",
  "min_inclusive": {
    "absolute": 0
  },
  "max_inclusive": {
    "absolute": 64
  }
}

Biased to Bottom

"start_height": {
  "type": "minecraft:biased_to_bottom",
  "min_inclusive": {
    "absolute": 0
  },
  "max_inclusive": {
    "absolute": 64
  },
  "inner": 16
}

Heightmap Types

The project_start_to_heightmap parameter accepts these values:
TypeDescription
WORLD_SURFACE_WGWorld surface during world generation
WORLD_SURFACEWorld surface including structures
OCEAN_FLOOR_WGOcean floor during world generation
OCEAN_FLOOROcean floor including structures
MOTION_BLOCKINGBlocks that block motion or contain fluids
MOTION_BLOCKING_NO_LEAVESLike MOTION_BLOCKING but ignores leaves

Dimension Padding

Prevents structures from generating too close to dimension boundaries:
"dimension_padding": {
  "bottom": 8,
  "top": 8
}
Or use the shorthand for no padding:
"dimension_padding": "NONE"

Liquid Settings

Controls how water is handled:
  • "IGNORE_WATERLOGGING" - Does not waterlog blocks (default)
  • "APPLY_WATERLOGGING" - Waterlogs waterloggable blocks when placed in water

Use Cases

Add-on Mod Structures

The ConditionalJigsawStructure is specifically designed for add-on mods (like LNE Add-Ons) that want to add structures depending on whether the base mod is loaded:
{
  "type": "more_rpg_classes:conditional_jigsaw",
  "mod_id": "lootandexplore",
  "start_pool": "lne_addon:dungeons/start_pool",
  "size": 5,
  "start_height": {
    "type": "minecraft:uniform",
    "min_inclusive": {"absolute": 0},
    "max_inclusive": {"absolute": 48}
  },
  "max_distance_from_center": 64
}
This structure will only generate if the “lootandexplore” mod is installed.

Datapack Compatibility

For datapacks that add content depending on other mods:
{
  "type": "more_rpg_classes:conditional_jigsaw",
  "mod_id": "wizards",
  "start_pool": "custom_pack:wizard_towers/centers",
  "size": 3,
  "start_height": {
    "type": "minecraft:uniform",
    "min_inclusive": {"absolute": 80},
    "max_inclusive": {"absolute": 120}
  },
  "project_start_to_heightmap": "WORLD_SURFACE_WG",
  "max_distance_from_center": 32
}

Integration with Structure Processors

ConditionalJigsawStructure works seamlessly with the custom structure processors:
{
  "type": "more_rpg_classes:conditional_jigsaw",
  "mod_id": "lootandexplore",
  "start_pool": "lne_addon:paths/start",
  "size": 7,
  "start_height": {"absolute": 0},
  "project_start_to_heightmap": "WORLD_SURFACE_WG",
  "max_distance_from_center": 96
}
Then in your structure pool templates, you can use the processors:
{
  "processors": "lne_addon:path_processors"
}
Where path_processors.json contains:
{
  "processors": [
    {
      "processor_type": "more_rpg_classes:path_adaptation",
      "filler_block": "minecraft:pink_concrete",
      "water_output": "minecraft:oak_planks",
      "terrain_mappings": [
        {"terrain": "#minecraft:sand", "output": "minecraft:smooth_sandstone"}
      ]
    },
    {
      "processor_type": "more_rpg_classes:water_pillar",
      "corner_block": "minecraft:yellow_concrete",
      "pillar_block": "minecraft:oak_log",
      "fence_block": "minecraft:oak_fence"
    },
    {
      "processor_type": "more_rpg_classes:terrain_blending",
      "blend_block": "minecraft:grass_block",
      "sample_radius": 2
    }
  ]
}

Implementation Details

Mod Loading Check

The structure uses Fabric Loader’s API to check for mod presence:
@Override
public Optional<StructurePosition> getStructurePosition(Context context) {
    if (!FabricLoader.getInstance().isModLoaded(modId)) {
        return Optional.empty();
    }
    // Continue with standard jigsaw generation...
}

CODEC Definition

The structure uses Mojang’s Codec system for serialization:
public static final MapCodec<ConditionalJigsawStructure> CODEC = 
    RecordCodecBuilder.<ConditionalJigsawStructure>mapCodec(instance ->
        instance.group(
            configCodecBuilder(instance),
            Codec.STRING.fieldOf("mod_id").forGetter(s -> s.modId),
            StructurePool.REGISTRY_CODEC.fieldOf("start_pool").forGetter(s -> s.startPool),
            // ... other fields
        ).apply(instance, ConditionalJigsawStructure::new)
    );

Registration

The structure type is registered in ModStructureTypes:
public static final StructureType<ConditionalJigsawStructure> CONDITIONAL_JIGSAW = 
    () -> ConditionalJigsawStructure.CODEC;

public static void register() {
    Registry.register(
        Registries.STRUCTURE_TYPE,
        MRPGCMod.id("conditional_jigsaw"),
        CONDITIONAL_JIGSAW
    );
}

Version History

  • v2.5.17 - Fixed some issues with ConditionalJigsawStructure and PathAdaptationProcessor
  • v2.5.16 - Added ConditionalJigsawStructure for LNE Add-On support