• 注册
  • MOD模组 MOD模组 关注:5 内容:16396

    yunfaLib (yunfaLib)

  • 查看作者
  • 打赏作者
  • 当前位置: SodaMC > MOD模组 > 正文
  • 潮涌核心
    反派

    yunfaLib (yunfaLib)


    A library for Minecraft using the Fabric API that adds config, math, events, modules, and more.


    Setup

    build.gradle

    repositories {
        maven { url "https://jitpack.io" }
    }
    
    dependencies {
        modImplementation "com.github.yunfachi:yunfaLib:${project.yunfalib_version}"
    }
    

    gradle.properties

    yunfalib_version=0.1.0
    

    Features

    Config

    Example Java: The values are stored in the inner class
    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 config = new Config<>(
                    new File("./modid/config.yml"), 
                    new ConfigKeys()
            );
            
            config.get().truth = "this value will be written after config.save()";
            config.save();
        }
    }
    
    Example Java: The values are stored in the nested class
    import moe.yunfachi.yunfalib.config.Config;
    import java.io.File;
    
    public class Example {
        public Example() {
            final Config 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";
    }
    
    Example Kotlin: The values are stored in the inner class
    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()
        }
    }
    
    Example Kotlin: The values are stored in an anonymous object
    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()
        }
    }
    

    Thanks

    Project Author Description
    Annotaml WiIIiam278 library for generating YAML files

    Stats

    yunfaLib (yunfaLib)

    来自Modrinth

    0.1.0

    yunfalib-0.1.0.jar下载0.1.0#Release
    展开
    版本: 0.1.0
    支持游戏: 1.20.1
    类型: Fabric
    Release
    下载次数: 234
  • 收录

  • 请登录之后再进行评论

    登录
  • Soda任务 图片
  • 偏好设置
  • 主题
  • 帖子间隔 侧栏位置: