Don't Register That
一款简单粗暴的 Minecraft Fabric 模组,用于阻止对象注册到注册表中。
使用场景
- 从游戏中移除特定的物品或方块
- 防止其他模组的有问题的或冲突的注册行为
- 有趣的实验性玩法
配置
该模组通过放置纯文本黑名单文件进行配置,路径为 config/dont_register_that/<registry_namespace>/<registry_path>.txt。每个非空行都被视为一个标识符(identifier),以 # 字符开头的行会被忽略。
例如,要阻止 minecraft:elytra 被注册到 minecraft:item 注册表中,你需要在 config/dont_register_that/minecraft/item.txt 创建一个文件,内容如下:
minecraft:elytra
重要的是要确保客户端和服务端的配置完全匹配,否则可能会导致注册表不匹配。
局限性
此模组仅阻止对象注册到注册表中。它不会进行任何调整以确保 Minecraft 或其他模组能优雅地处理这种情况。请自行承担风险使用该模组,并在更改配置之间始终备份你的世界。
内部行为
对 Registry.register(Registry<V> registry, ResourceKey<V> resourceKey, T object) 的调用会被拦截并取消,如果 ResourceKey 与黑名单中的条目匹配。
返回值会根据注册表的不同而替换:
- 对于
minecraft:item,返回 Items.STONE
- 对于
minecraft:block,返回 Blocks.STONE
- 对于所有其他注册表,返回值是传入的
T object
未注册的侵入式持有者(Unregistered Intrusive Holders)
阻止对象注册通常会产生创建未注册的侵入式持有者的副作用。这通常是一个无效状态,会导致启动时崩溃,但此模组会将其替换为日志中的警告:
[XX:XX:XX] [Render thread/WARN] (Don't Register That) Registry <id> has unregistered intrusive holders, silencing error!
Don't Register That
A quick and dirty Minecraft Fabric mod to stop registration of objects into the registries.
Use Cases
- Removing specific items or blocks from the game
- Preventing problematic or conflicting registrations from other mods
- Fun experimentation
Configuration
The mod is configured by placing plaintext blacklist files at config/dont_register_that/<registry_namespace>/<registry_path>.txt. Each non-empty line is treated as an identifier, lines starting with the # character are ignored.
For example, to block minecraft:elytra being registered into the minecraft:item registry, you would create a file at config/dont_register_that/minecraft/item.txt with the contents:
minecraft:elytra
It is important to ensure that the client-side and server-side configurations match exactly, or there may be registry mismatches.
Limitations
This mod only prevents registration of objects into the registry. It does not make any adjustments to ensure that Minecraft or other mods handle this gracefully. Use this mod at your own risk, and always back up your worlds between config changes.
Internal Behaviour
Calls to Registry.register(Registry<V> registry, ResourceKey<V> resourceKey, T object) are intercepted and cancelled if the ResourceKey matches a blacklisted entry.
The return value is replaced depending on the registry:
- For
minecraft:item, Items.STONE is returned
- For
minecraft:block, Blocks.STONE is returned
- For all other registries, the return value is the passed
T object
Unregistered Intrusive Holders
Preventing objects being registered often has the side effect of creating unregistered intrusive holders. This is usually an invalid state that will cause a crash on startup, but this mod replaces it with a warning in the log:
[XX:XX:XX] [Render thread/WARN] (Don't Register That) Registry <id> has unregistered intrusive holders, silencing error!
评论 0
登录后参与评分
还没有评论,来抢沙发吧