From 9b4607766476d2ec3eea31fa7fec6c8134fc869a Mon Sep 17 00:00:00 2001 From: valoeghese Date: Thu, 7 May 2020 18:57:09 +1200 Subject: [PATCH] update api and add config example --- gradle.properties | 2 +- .../example/ExampleMod.java | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 4c75ebf..98694ae 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties minecraft_version=b1.7.3 loader_version=86e7520 - api_version=v0.1.1 + api_version=v0.1.2 # Mod Properties mod_version = 1.0.0 diff --git a/src/main/java/io/github/minecraftcursedlegacy/example/ExampleMod.java b/src/main/java/io/github/minecraftcursedlegacy/example/ExampleMod.java index a14d81a..0d3df58 100644 --- a/src/main/java/io/github/minecraftcursedlegacy/example/ExampleMod.java +++ b/src/main/java/io/github/minecraftcursedlegacy/example/ExampleMod.java @@ -1,6 +1,12 @@ package io.github.minecraftcursedlegacy.example; +import java.io.IOException; + +import io.github.minecraftcursedlegacy.api.config.Configs; +import io.github.minecraftcursedlegacy.api.registry.Id; import net.fabricmc.api.ModInitializer; +import tk.valoeghese.zoesteriaconfig.api.container.WritableConfig; +import tk.valoeghese.zoesteriaconfig.api.template.ConfigTemplate; public class ExampleMod implements ModInitializer { @Override @@ -10,5 +16,19 @@ public class ExampleMod implements ModInitializer { // Proceed with mild caution. System.out.println("Hello Fabric world!"); + + // example config + try { + config = Configs.loadOrCreate(new Id("modid", "example"), + ConfigTemplate.builder().addContainer("exampleContainer", e -> e + .addDataEntry("someData", "0.5")) + .build()); + } catch (IOException e) { + throw new RuntimeException(e); + } + + System.out.println(config.getDoubleValue("exampleContainer.someData")); } + + private static WritableConfig config; }