Skip to main content

Overview

Regions Unexplored uses a centralized registration system through the RegionsUnexplored main class and several registry interfaces. All game content (blocks, items, biomes, features, etc.) is registered during mod initialization.

Main initialization

The mod’s entry point is RegionsUnexplored.java, which coordinates all registry initialization:
RegionsUnexplored.java:26-40
public static void init() {
    registerConfig("regions unexplored/regions_unexplored-client", "Client", RuClientConfig.class);
    registerConfig("regions unexplored/regions_unexplored-common", "Common", RuCommonConfig.class);

    RUBiomes.init();
    RUBlocks.init();
    RUCreativeModeTabs.init();
    RUEntityTypes.init();
    RUFeatureTypes.init();
    RUFoliagePlacerTypes.init();
    RUItems.init();
    RUParticleTypes.init();
    RUSoundEvents.init();
    RUTreeDecoratorTypes.init();
}
The init() method must be called before Minecraft finishes registry freezing. Additional setup happens in afterRegistriesFreeze() for compatibility and late initialization.

Post-registration setup

After registries are frozen, the mod performs additional setup:
RegionsUnexplored.java:42-48
public static void afterRegistriesFreeze(){
    BlockToolCompat.setup();
    FlammableBlocks.setup();
    RuBiolith.init();
}

Core registries

Registry interfaces

Regions Unexplored organizes content into registry interfaces:

RUBlocks

Block registration and wood/natural sets

RUItems

Item registration and food properties

RUBiomes

Biome resource keys and villager types

RUFeatureTypes

World generation features

RUFoliagePlacerTypes

Custom foliage placer types

RUTreeDecoratorTypes

Tree decorator types

RUParticleTypes

Custom particle types

RUSoundEvents

Sound event registration

Utility methods

Resource location helpers

The main class provides helper methods for creating resource identifiers:
// Create a ResourceLocation with the mod namespace
Identifier id = RegionsUnexplored.id("alpha_log");
// Result: regions_unexplored:alpha_log

// Get string representation
String stringId = RegionsUnexplored.stringId("alpha_log");
// Result: "regions_unexplored:alpha_log"

Method signatures

id
static Identifier
Creates a namespaced identifier with the mod ID
stringId
static String
Creates a string representation of a namespaced identifier
key
static ResourceKey<T>
Creates a ResourceKey for a registry entry

Constants

MOD_ID
String
The mod identifier: "regions_unexplored"
LOGGER
Logger
SLF4J logger instance for the mod

Registration pattern

All registry interfaces follow a similar pattern:
Example registration pattern
public interface RUBlocks {
    // Supplier provides lazy initialization
    Supplier<Block> PRISMOSS = register(
        "prismoss",
        p -> new PrismossBlock(p.mapColor(MapColor.COLOR_LIGHT_GREEN)
            .sound(SoundType.STONE)
            .randomTicks()
            .strength(1.5f, 6f)
            .requiresCorrectToolForDrops())
    );
    
    static void init() {
        // Empty - registration happens via static initialization
    }
}
The init() method triggers static initialization of the interface, which causes all Supplier fields to be evaluated and registered.

Platform abstraction

The mod uses a platform-agnostic Registrar class for cross-loader compatibility:
Platform registration
// From RUFoliagePlacerTypes.java
static <T extends FoliagePlacer> Supplier<FoliagePlacerType<T>> register(
    String name,
    FoliagePlacerType<T> type
) {
    Registrar.register(BuiltInRegistries.FOLIAGE_PLACER_TYPE, name, () -> type);
    return () -> type;
}
The Registrar class handles differences between Forge, Fabric, and other mod loaders, ensuring the mod works across platforms.

Build docs developers (and LLMs) love