yunfaLib
一个基于 Fabric API 的 Minecraft 库,提供配置、数学工具、事件、模块等功能。
环境配置
build.gradle
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
modImplementation "com.github.yunfachi:yunfaLib:${project.yunfalib_version}"
}
gradle.properties
yunfalib_version=0.1.0
功能特性
配置
Java 示例:值存储在内部类中
import moe.yunfachi.yunfalib.config.Config;
import java.io.File;
public class Example {
private static class ConfigKeys {
String truth = "this value is immediately saved to a file";
}
public Example() {
final Config<ConfigKeys> config = new Config<>(
new File("./modid/config.yml"),
new ConfigKeys()
);
config.get().truth = "this value will be written after config.save()";
config.save();
}
}
Java 示例:值存储在嵌套类中
import moe.yunfachi.yunfalib.config.Config;
import java.io.File;
public class Example {
public Example() {
final Config<ConfigKeys> config = new Config<>(
new File("./modid/config.yml"),
new ConfigKeys()
);
config.get().truth = "this value will be written after config.save()";
config.save();
}
}
class ConfigKeys {
String truth = "this value is immediately saved to a file";
}
Kotlin 示例:值存储在内部类中
import moe.yunfachi.yunfalib.config.Config
import java.io.File
class Example {
init {
class ConfigKeys {
var truth = "this value is immediately saved to a file"
}
val config = Config(
File("./modid/config.yml"),
ConfigKeys()
)
config.get().truth = "this value will be written after config.save()"
config.save()
}
}
Kotlin 示例:值存储在匿名对象中
import moe.yunfachi.yunfalib.config.Config
import java.io.File
class Example {
init {
val config = Config(
File("./modid/config.yml"),
object {
var truth: String = "this value is immediately saved to a file"
}
)
config.get().truth = "this value will be written after config.save()"
config.save()
}
}
致谢
| 项目 | 作者 | 描述 |
|---|---|---|
| Annotaml | WiIIiam278 | 用于生成 YAML 文件的库 |
统计
你是这个资源的作者?登录后可认领此资源。
相似资源
Woot Revived
pharuxtan
一个用于收集生物掉落物的多区块模组。
生物科技
349
玉Jade ?
Snownee
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
实用前置
341
物品管理器Just Enough Items (JEI)
mezz
查看物品与配方
前置实用
240
KubeJS
Lat
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
前置实用
239
AAA Particles
ChloePrime
适用于 MC 1.18+ 的 Effekseer 加载器
前置装饰
186
WTHIT
deirn
那是什么?一个 Waila/Hwyla 的分支。
前置实用
165
评论 0
登录后参与评分
还没有评论,来抢沙发吧