Перейти к содержимому
Mineforgian

RegistryEdit

Very small library to modify and replace assets in Registries

Загрузки
1K
Подписчики
6
Обновлён
1 апреля 2024 г.
Лицензия
MIT

Опубликован 13 марта 2024 г.

A often unneeded, yet sometimes required feature, put into a library: Modifying registry elements at runtime. Not much explanation is needed for this library, other than if used improperly it can cause errors.

How to use:

void Initialize() {
    ...
    //Note: do NOT use Registry.register(...) on the 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
        // other elements (Any, so long as the field holding it is static 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 removing elements entirely (VERY DANGEROUS UNLESS YOU KNOW WHAT YOU ARE DOING!)
        manipulator.Unregister(Registries.ITEM, Items.ENDER_PEARL);

        // If you are removing a block, ensure you replace the BlockItem associated with it!
        manipulator.Unregister(Registries.BLOCK, Blocks.COBBLESTONE);
        manipulator.Redirect(Registries.Item, Items.COBBLESTONE, new Item(new Item.Settings()));
    });
    
    ...
}

Assuming you are overriding an item in the Items / Blocks class (ie, where Items.STICK would be located) the registry edit will apply to that variable as well. If you need to modify an element that isn't in the Items / Blocks class, you can provide your holder class.

Центр версий

6 версий
  • Релиз31 КБ
  • Бета19 КБ
  • Релиз201 КБ
  • Релиз201 КБ
  • Релиз202 КБ
  • Релиз13 КБ

Ченджлог

1.0.4Релиз1.20.4 · 1 апреля 2024 г.

Fixed redirect issues

  • Tested on Vanilla Client + Modded Server

Effectively works as an alternate Polymer implementation on Vanilla. Same rules apply for when redirecting block(s) as items are not modified by default

1.0.2+1.20.2-quiltБета1.20.2, 1.20.3, 1.20.4 · 26 марта 2024 г.

Versions this jar says are supported are NOT guaranteed to work! If issues occur, PLEASE create an issue on Github!

1.0.2+1.20.2Релиз1.20.2 · 26 марта 2024 г.

Port to 1.20.2

1.0.2Релиз1.20.4 · 25 марта 2024 г.

Fixed issue related to chunks not being properly sent to client (requires this mod on client (?) )

Комментарии

Загружаем…