Download RegistryEdit — Minecraft Mods — MetaMods

RegistryEdit

Active

Downloads

0

Last update

1 year ago

Versions

1.20 — 1.20.4
Client
Fabric
Quilt
Libraries
Control

RegistryEdit

This library provides functionality that is rarely needed but can be indispensable in certain situations - the ability to modify registry elements during program execution.

How to Use

void Initialize() {
    ...
    //Important: Do NOT use Registry.register(...) for custom assets!
    RegistryEditEvent.EVENT.register(manipulator -> {
        // For native Minecraft elements (Item/Block)
        var myCustomItem1 = new Item(new Item.Settings());
        manipulator.Redirect(Registries.ITEM, Items.STICK, myCustomItem1);
        // ++ Items.STICK = myCustomItem1
        // -- Items.STICK = EXISTING_ITEM

        // For other elements (any, provided the field is static and final)
        var myCustomItem2 = new Item(new Item.Settings());
        manipulator.Redirect(MyItems.class, Registries.ITEM, MyItems.CUSTOM_ITEM, myCustomItem2);
        // ++ MyItems.CUSTOM_ITEM = myCustomItem2
        // -- MyItems.CUSTOM_ITEM = EXISTING_ITEM

        // For complete removal of elements (VERY DANGEROUS! Use only if you know what you're doing!)
        manipulator.Unregister(Registries.ITEM, Items.ENDER_PEARL);

        // If removing a block, make sure to replace the associated BlockItem!
        manipulator.Unregister(Registries.BLOCK, Blocks.COBBLESTONE);
        manipulator.Redirect(Registries.Item, Items.COBBLESTONE, new Item(new Item.Settings()));
    });
    ...
}

The library works in such a way that if you replace an element in the Items or Blocks classes (for example, replacing Items.STICK), changes are automatically applied to the corresponding variables. To work with elements that are not in these standard classes, you can specify your own container class.

Project members
Feintha

Feintha

Developer

Created: 15 Mar 2024

ID: 17333