介绍
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.
常见问题
RegistryEdit 支持哪些 Minecraft 版本?
RegistryEdit 支持 Minecraft Java 版 1.20–1.20.4,共 5 个版本,可用的加载器:Fabric / Quilt。下载时注意选择和你游戏版本一致的文件。
RegistryEdit 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric / Quilt,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:客户端 / 服务端。
Feintha 的其他作品
查看全部 →
Origin Furs
A Origins extension mod which adds visuals for each origin, that modifies and adds onto the player model.
TerraFirmaCraft Ars Nouveau Compatibility
Adds generation for Ars Nouveau's Sourceberry Bush to TFC worlds
Music Boxes
A mod that adds music boxes which can play songs on Note Blocks
Faelib APIs
Compilation of common code shared between my mods
评论
登录后评论和评分