Skip to content

Commit

Permalink
1.19.2 update with maven publishing and README polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
Draylar committed Mar 2, 2023
1 parent 239ec7c commit 505d3e7
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 29 deletions.
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# ΩConfig
<h1 align="center">Omega Config Ω </h1>
<p align="center">A configuration library by <a href="https://github.com/Draylar">Draylar</a></p>

---

*The last config library you will ever use.*

ΩConfig is a hyper-minimal config library based on [Auto Config](https://github.com/shedaniel/AutoConfig). It aims to
achieve the following goals:

Expand All @@ -20,6 +19,10 @@ public class TestConfig implements Config {
@Comment(value = "Hello!")
boolean value = false;

@Syncing
@Comment(value = "This value will sync to the client!")
boolean syncableValue = false;

@Override
public String getFileName() {
return "test-config";
Expand Down Expand Up @@ -63,12 +66,12 @@ you can use the following gradle declarations:

```groovy
repositories {
maven { url 'https://jitpack.io' }
maven { url 'https://maven.draylar.dev/releases' }
}
// 1.19.2 version: 1.3.0+1.19.2
dependencies {
include("com.github.Draylar.omega-config:omega-config-base:${project.omega_config_version}")
modImplementation("com.github.Draylar.omega-config:omega-config-base:${project.omega_config_version}")
modImplementation include("dev.draylar.omega-config:omega-config-base:${project.omega_config_version}")
}
```

Expand All @@ -95,8 +98,7 @@ repositories {
dependencies {
... (including the base declarations)
include("com.github.Draylar.omega-config:omega-config-gui:${project.omega_config_version}")
modImplementation("com.github.Draylar.omega-config:omega-config-gui:${project.omega_config_version}")
modImplementation include("dev.draylar.omega-config:omega-config-gui:${project.omega_config_version}")
modRuntimeOnly ("com.terraformersmc:modmenu:${project.modmenu_version}") // 3.0.1 for 1.18.1
}
```
Expand All @@ -110,12 +112,12 @@ dependencies {
**save()** - *saves a modified configuration instance to disk*

```java
MyModInitializer.CONFIG.value=false;
MyModInitializer.CONFIG.save(); // writes the new value to disk
MyModInitializer.CONFIG.value = false;
MyModInitializer.CONFIG.save(); // writes the new value to disk
```


**@Syncing** - *configuration options marked with this annotation will automatically sync to the client when they join a server.*
`@Syncing` - *configuration options marked with this annotation will automatically sync to the client when they join a server.*

---

Expand Down
19 changes: 15 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
plugins {
id "fabric-loom" version "0.10-SNAPSHOT"
id "fabric-loom" version "1.1-SNAPSHOT"
id "maven-publish"
id "java-library"
}

group = "draylar"
group = "dev.draylar"
archivesBaseName = "omega-config"

subprojects {
apply plugin: 'fabric-loom'
apply plugin: 'maven-publish'

archivesBaseName = project.name
group = "draylar.${project.group}"
group = "dev.draylar.${project.group}"

// Only publish for submodules (not the root project) - add standard jar, + sources & development jar
publishing {
repositories {
maven {
name = "draylarRepository"
url = "https://maven.draylar.dev/releases"
credentials(PasswordCredentials)
authentication {
basic(BasicAuthentication)
}
}
}

publications {
mavenJava(MavenPublication) {
from components.java
Expand All @@ -33,7 +44,7 @@ subprojects {
allprojects {
apply plugin: "fabric-loom"
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
version = project.mod_version + "-" + project.minecraft_version
version = project.mod_version + "+" + project.minecraft_version

repositories {
maven {
Expand Down
13 changes: 6 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
org.gradle.jvmargs=-Xmx2G
# Fabric Properties
# check these on https://fabricmc.net/versions.html
minecraft_version=1.18.1
yarn_mappings=1.18.1+build.12
loader_version=0.12.12
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.28
loader_version=0.14.14
fabric_version=0.75.1+1.19.2

#Fabric api
fabric_version=0.45.0+1.18
# Mod Properties
mod_version=1.2.3
maven_group=draylar
mod_version=1.3.0
maven_group=dev.draylar
archives_base_name=omega-config

modmenu_version=3.0.1
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
import net.fabricmc.api.Environment;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.text.LiteralText;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
Expand Down Expand Up @@ -56,12 +55,12 @@ public static OmegaScreenFactory<Screen> getConfigScreenFactory(Config config) {
return parent -> {
try {
Config defaultConfig = config.getClass().getDeclaredConstructor().newInstance();
ConfigScreen screen = ConfigScreen.create(new TranslatableText(String.format("config.%s.%s", config.getModid(), config.getName())), parent);
ConfigScreen screen = ConfigScreen.create(Text.translatable(String.format("config.%s.%s", config.getModid(), config.getName())), parent);

// Fields
for (Field field : config.getClass().getDeclaredFields()) {
try {
screen.add(new LiteralText(field.getName()), field.get(config), () -> {
screen.add(Text.of(field.getName()), field.get(config), () -> {
try {
return field.get(defaultConfig);
} catch (IllegalAccessException e) {
Expand Down
6 changes: 3 additions & 3 deletions src/testmod/java/draylar/omegatest/OmegaTestClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;

public class OmegaTestClient implements ClientModInitializer {

Expand All @@ -13,8 +13,8 @@ public void onInitializeClient() {
OmegaConfigGui.registerConfigScreen(OmegaTestMain.CONFIG);

HudRenderCallback.EVENT.register((stack, delta) -> {
MinecraftClient.getInstance().textRenderer.draw(stack, new LiteralText(String.valueOf(OmegaTestMain.CONFIG.v)), 15, 15, 0xffffff);
MinecraftClient.getInstance().textRenderer.draw(stack, new LiteralText(String.valueOf(OmegaTestMain.CONFIG.doubleTest)), 15, 30, 0xffffff);
MinecraftClient.getInstance().textRenderer.draw(stack, Text.literal(String.valueOf(OmegaTestMain.CONFIG.v)), 15, 15, 0xffffff);
MinecraftClient.getInstance().textRenderer.draw(stack, Text.literal(String.valueOf(OmegaTestMain.CONFIG.doubleTest)), 15, 30, 0xffffff);
});
}
}

0 comments on commit 505d3e7

Please sign in to comment.