免责声明
我收到了多份关于 LibCD 模组 JSON 中存在无效条目的问题报告。这不会导致崩溃。这不是你的整合包无法加载的原因。请在日志中进一步查找导致崩溃的真正原因。
LibCapableData(简称 LibCD)添加了各种钩子,使数据包更易于使用。
条件数据
LibCD 最初的功能是作为挂钩,根据元数据文件有条件地加载数据包元素。它专注于简单性和可扩展性,同时兼容其他模组添加的任何资源类型。此模组需要 Minecraft 1.14 及以上版本的 Fabric 启动器。
对于条件资源,添加一个文件 <目标资源名及扩展名>.mcmeta。该文件将被解析为 JSON 以检查是否应加载此资源。每个键值对将指定一个必须满足的条件,才能使配方被加载。系统预置了四种条件,其他模组也可能添加自己的条件:
libcd:mod_loaded(传入字符串):如果存在指定模组 ID 的模组,则返回 true。
libcd:item_exists(传入字符串):如果存在指定物品 ID 的物品,则返回 true。
libcd:not(传入单个元素的 JSON 对象):如果给定对象中列出的条件 不 为真,则返回 true。
libcd:any_of(传入一个 JSON 对象):如果给定对象中列出的 任意 条件为真,则返回 true。
警告:目前,如果传入的参数不正确,条件会静默地返回 false。希望将来能对此进行修改,但如果你认为某个内容应该加载却没有加载,请检查你的条件。
开发者使用
LibCD 允许任何模组注册自己的条件,从而基于配置或更高级的逻辑阻止配方加载。LibCD 可在 Cotton maven 上获取。
要添加新条件,请调用 LibConditionalData.registerCondition(),传入表示条件名称的 Identifier 以及用于判断条件是否适用的 `Predicate`。
传递给 predicate 的对象将是一个装箱的基本类型(Integer、Float、Boolean 等)、String、List、JsonObject 或 null。请使用 instanceof 检查来确认你接收到的具体类型。
有关创建 Tweaker 实用程序的信息,请查看 LibCD wiki 页面。
DISCLAIMER
I have received multiple reports of an issue regarding invalid entries in the LibCD mod jSON. THIS DOES NOT CAUSE A CRASH. THIS IS NOT THE REASON YOUR PACK IS NOT LOADING. PLEASE LOOK FURTHER IN THE LOG FOR THE REAL CAUSE OF THE CRASH.
LibCapableData, or LibCD, adds various hooks to make data packs more usable.
Conditional Data
LibCD's original function was as a hook to conditionally load data pack elements based on a metadata file. It's focused on being simple and extensible, along with being compatible with any resource type added by other mods. This mod requires the Fabric launcher for Minecraft 1.14 and above.
For conditional resources, add a file <target resource with extension>.mcmeta. This will be parsed as JSON to check whether the resource should be loaded. Each key-value pair will specify a condition that must be met for the recipe to be loaded. There are four conditions pre-included, and other mods may add their own:
libcd:mod_loaded (passed a string): Will return true if a mod with the given mod ID is loaded.
libcd:item_exists (passed a string): Will return true if an item with the given item ID is loaded.
libcd:not (passed a single-element json object) Will return true if the condition listed in the given object is not true.
libcd:any_of (passed a json object): Will return true if any condition listed in the given object is true.
WARNING: Currently, conditions silently return false if they are passed an improper parameter. This will hopefully be changed in the future, but if you think something should be loaded and it isn't, check your conditions.
Developer Use
LibCD allows any mod to register their own conditions, to prevent recipe loadin based on config or more advanced logic. LibCD is available on the Cotton maven.
To add a new condition, call LibConditionalData.registerCondition(), passing an Identifier for the condition's name and a `Predicate for the use of the condition.
The Object passed to the predicate will be a boxed primitive (Integer, Float, Boolean, etc.), a String, a List, a JsonObject, or null. Use an instanceof check to be sure what you're being passed.
For information on creating Tweaker utilities, check the LibCD wiki page.
评论 0
登录后参与评分
还没有评论,来抢沙发吧