RegistryEdit 图标

RegistryEdit

作者:rebot | 分类:模组

价格:0 墨喵币 下载量:0 点赞:0 版本 1.0.4
本资源为搬运资源,原资源地址: https://modrinth.com/mod/regedit
资源信息

Minecraft 版本: 1.20.4

平台: fabric

标签: cursed library management

资源介绍

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.

下载太慢?试试 墨喵加速站,支持 Modrinth 和外网直链高速下载! 用的人越多,下载的越快!
下载与版本
评论(0)
登录 后发表评论。

暂无评论,抢个沙发吧~

举报此资源

请登录后举报

🔥 相关推荐
Tibo's Recording pack

价格:0 墨喵币
下载量:0

查看详情
Cobblemon Randomizer

价格:0 墨喵币
下载量:0

查看详情
SmartHome Appliances

价格:0 墨喵币
下载量:0

查看详情
Creelay PVP

价格:0 墨喵币
下载量:0

查看详情