介绍
中文介绍正在准备中,下面暂时显示原文。
This is a LIBRARY mod, if you are a user just INSTALL it, do not read below!
For Developers —
Adding the dependancy [
Just use CurseMaven, the repository for that is here, https://www.cursemaven.com/
Add the dependency using the snippet in the needed version in Files
example (not the right mod)
implementation "curse.maven:cloth-config-348521:5987045"
]
Pros and Cons vs Forge’s config
-Pros ———————————-
- Uses JSON instead of TOML, making it more reliable (For example, Forge Configs do not easily support empty lists and can break when using them)
- Compatible with reading and writing many more Java / Minecraft classes than Forge configs (For example, Vec3 cannot be written or read to a forge config, JasonConfig has no issues with it because of JSON objects)
- Simpler to write in code while still being similar to how you create Forge config classes (see below)
-Cons ———————————-
- Slightly less user readable because its in JSON format
- Experimental, while I havn’t found bugs yet I’m sure some will come, I’m only one guy after all
- No sided configs, technically while if you just use a value on one side, it’ll take that side’s version of the config (so dedicated server and client specific configs should work fine), there are no configs per world like “serverconfigs” work
Example Config (Can also be found in the “api” package of the mod once you add it to your dependencies)
Everything you need in the “api” package is well documented and should be referred to
public class SimpleExampleConfigClass {
public static final Config EXAMPLE_CONFIG = new Config(MODID + "-example_config");
///The following config values are called with the {<code>EXAMPLE_CONFIG</code>} Config passed in, this automatically adds it to the Config
public static final ConfigValue<Float> EXAMPLE_FLOAT = new ConfigValue<>(10f, "exampleFloat", EXAMPLE_CONFIG);
///Comments are placed in order of declaration, so this comment will be below {<code>EXAMPLE_FLOAT</code>} and above {<code>EXAMPLE_LIST</code>}
public static final ConfigComment EXAMPLE_COMMENT = new ConfigComment("This is a list!", EXAMPLE_CONFIG);
public static final ConfigValue<List<String>> EXAMPLE_LIST = new ConfigValue<>(List.of("value1", "value2", "value3", "value4"), "exampleList", EXAMPLE_CONFIG);
public static final ConfigComment VEC3_COMMENT = new ConfigComment("This is a Vec3! Many Java classes that don't work in Forge configs will work here!", EXAMPLE_CONFIG);
public static final ConfigValue<Vec3> EXAMPLE_VEC3 = new ConfigValue<>(new Vec3(123,123,123), "exampleVec3", EXAMPLE_CONFIG);
///This method must be called in your mod's Main class
/// You will need to call the {<code>register()</code>} method on the {<code>Config</code>} you declared
/// and add any {<code>ConfigValue<?></></code>} variables you created if you did not assign them in the constructor
public static void init()/* This method can be called anything, init(), register(), etc*/ {
EXAMPLE_CONFIG.register();
///EXAMPLES OF GRABBING VALUES
//EXPLICIT (Very similar to Forge's Config)
SimpleExampleConfigClass.EXAMPLE_FLOAT.get();
}
}
常见问题
JasonConfig 支持哪些 Minecraft 版本?
JasonConfig 支持 Minecraft Java 版 1.20.1–1.21.1,共 2 个版本,可用的加载器:Forge / NeoForge。下载时注意选择和你游戏版本一致的文件。
JasonConfig 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 Forge / NeoForge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。
jeducklet 的其他作品
查看全部 →TACZ: Durability (Timeless and Classics Guns)
by jeducklet
为 Timeless and Classics 枪械添加耐久度,并加入卡壳与修理系统。
707.6万
2 个月前
CurseForge
Apocalypse Patches
by jeducklet
Patches for the ApocalypseNow mod to fix mod compatible and performance issues.
356.6万
3 个月前
CurseForge
TACZ: Npcs
by jeducklet
Fully animated neutral and enemy NPCs with loot tables
160.9万
2 个月前
CurseForge
Tactical Movement Renewed (Point Blank and TACZ)
by jeducklet
Leaning, Point Aiming, Crawling and more, with first person animations, a continuation of the TACtical Movement mod
95.1万
2 年前
CurseForge
评论
登录后评论和评分