update api and add config example

pull/5/head
valoeghese 5 years ago
parent 16e129df59
commit 9b46077664

@ -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

@ -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;
}

Loading…
Cancel
Save