Work around cloth breaking enums, closes #15
This commit is contained in:
parent
576c65135c
commit
934cb10a09
|
@ -32,7 +32,7 @@ dependencies {
|
||||||
modImplementation("com.terraformersmc:modmenu:2.0.5")
|
modImplementation("com.terraformersmc:modmenu:2.0.5")
|
||||||
include modImplementation("com.github.MeteorDevelopment:starscript:0.1.5")
|
include modImplementation("com.github.MeteorDevelopment:starscript:0.1.5")
|
||||||
modApi("me.shedaniel.cloth:cloth-config-fabric:5.0.38")
|
modApi("me.shedaniel.cloth:cloth-config-fabric:5.0.38")
|
||||||
modCompileOnly "io.vram:frex-fabric-mc117:6.0.+"
|
modCompileOnly "io.vram:frex-fabric-mc117:6.0.145"
|
||||||
include modImplementation("io.gitlab.jfronny.libjf:libjf-data-manipulation-v0:${project.jfapi_version}") {
|
include modImplementation("io.gitlab.jfronny.libjf:libjf-data-manipulation-v0:${project.jfapi_version}") {
|
||||||
exclude(group: "net.fabricmc.fabric-api")
|
exclude(group: "net.fabricmc.fabric-api")
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/versions.html
|
# check these on https://fabricmc.net/versions.html
|
||||||
minecraft_version=1.17.1
|
minecraft_version=1.17.1
|
||||||
yarn_mappings=build.61
|
yarn_mappings=build.63
|
||||||
loader_version=0.12.1
|
loader_version=0.12.5
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=2.8.1
|
mod_version=2.8.2
|
||||||
maven_group=io.gitlab.jfronny
|
maven_group=io.gitlab.jfronny
|
||||||
archives_base_name=respackopts
|
archives_base_name=respackopts
|
||||||
# Dependencies
|
# Dependencies
|
||||||
fabric_version=0.40.1+1.17
|
fabric_version=0.42.1+1.17
|
||||||
jfapi_version=2.1.2
|
jfapi_version=2.1.3
|
||||||
|
|
||||||
modrinth_id=TiF5QWZY
|
modrinth_id=TiF5QWZY
|
||||||
modrinth_required_dependencies=3CD6YUw1
|
modrinth_required_dependencies=3CD6YUw1
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
"rpo.lumi": "${Lumi} ${Lights}",
|
"rpo.lumi": "${Lumi} ${Lights}",
|
||||||
"rpo.lumi.tonemap": "Tonemap mode",
|
"rpo.lumi.tonemap": "Tonemap mode",
|
||||||
"rpo.tooltip.lumi.tonemap": "Tooltip test",
|
"rpo.tooltip.lumi.tonemap": "Tooltip test",
|
||||||
|
"rpo.lumi.tonemap.default": "Default Tonemap",
|
||||||
|
"rpo.lumi.tonemap.vibrant": "Vibrant Tonemap",
|
||||||
|
"rpo.lumi.tonemap.film": "Filmic Tonemap",
|
||||||
"rpo.lumi.pbr": "Enable PBR",
|
"rpo.lumi.pbr": "Enable PBR",
|
||||||
"rpo.lumi.debugMode": "Debug Mode",
|
"rpo.lumi.debugMode": "Debug Mode",
|
||||||
"rpo.lumi.debugMode.normal": "${Normal} Mode",
|
"rpo.lumi.debugMode.normal": "${Normal} Mode",
|
||||||
|
|
|
@ -13,7 +13,7 @@ import io.gitlab.jfronny.respackopts.gson.entry.ConfigBranchSerializer;
|
||||||
import io.gitlab.jfronny.respackopts.gson.entry.EnumEntrySerializer;
|
import io.gitlab.jfronny.respackopts.gson.entry.EnumEntrySerializer;
|
||||||
import io.gitlab.jfronny.respackopts.gson.entry.NumericEntrySerializer;
|
import io.gitlab.jfronny.respackopts.gson.entry.NumericEntrySerializer;
|
||||||
import io.gitlab.jfronny.respackopts.util.RpoCommand;
|
import io.gitlab.jfronny.respackopts.util.RpoCommand;
|
||||||
import io.gitlab.jfronny.respackopts.data.entry.*;
|
import io.gitlab.jfronny.respackopts.tree.*;
|
||||||
import io.gitlab.jfronny.respackopts.filters.FileFilterEventImpl;
|
import io.gitlab.jfronny.respackopts.filters.FileFilterEventImpl;
|
||||||
import io.gitlab.jfronny.respackopts.util.GuiFactory;
|
import io.gitlab.jfronny.respackopts.util.GuiFactory;
|
||||||
import meteordevelopment.starscript.Script;
|
import meteordevelopment.starscript.Script;
|
||||||
|
@ -119,7 +119,7 @@ public class Respackopts implements ClientModInitializer {
|
||||||
});
|
});
|
||||||
SAVE_ACTIONS.add(() -> {
|
SAVE_ACTIONS.add(() -> {
|
||||||
if (CONFIG.debugLogs)
|
if (CONFIG.debugLogs)
|
||||||
LOGGER.info("Generating FREX shader code");
|
LOGGER.info("Generating shader code");
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("#ifndef respackopts_loaded");
|
sb.append("#ifndef respackopts_loaded");
|
||||||
sb.append("\n#define respackopts_loaded");
|
sb.append("\n#define respackopts_loaded");
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package io.gitlab.jfronny.respackopts.data;
|
package io.gitlab.jfronny.respackopts.data;
|
||||||
|
|
||||||
import io.gitlab.jfronny.respackopts.data.entry.ConfigBranch;
|
import io.gitlab.jfronny.respackopts.tree.ConfigBranch;
|
||||||
import io.gitlab.jfronny.respackopts.data.enums.PackCapability;
|
import io.gitlab.jfronny.respackopts.data.enums.PackCapability;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
|
@ -2,7 +2,7 @@ package io.gitlab.jfronny.respackopts.data.condition;
|
||||||
|
|
||||||
import com.google.gson.JsonParseException;
|
import com.google.gson.JsonParseException;
|
||||||
import io.gitlab.jfronny.respackopts.Respackopts;
|
import io.gitlab.jfronny.respackopts.Respackopts;
|
||||||
import io.gitlab.jfronny.respackopts.data.entry.ConfigBranch;
|
import io.gitlab.jfronny.respackopts.tree.ConfigBranch;
|
||||||
import io.gitlab.jfronny.respackopts.util.RpoFormatException;
|
import io.gitlab.jfronny.respackopts.util.RpoFormatException;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package io.gitlab.jfronny.respackopts.gson.entry;
|
package io.gitlab.jfronny.respackopts.gson.entry;
|
||||||
|
|
||||||
import com.google.gson.*;
|
import com.google.gson.*;
|
||||||
import io.gitlab.jfronny.respackopts.data.entry.ConfigBooleanEntry;
|
import io.gitlab.jfronny.respackopts.tree.ConfigBooleanEntry;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package io.gitlab.jfronny.respackopts.gson.entry;
|
||||||
|
|
||||||
import com.google.gson.*;
|
import com.google.gson.*;
|
||||||
import io.gitlab.jfronny.respackopts.Respackopts;
|
import io.gitlab.jfronny.respackopts.Respackopts;
|
||||||
import io.gitlab.jfronny.respackopts.data.entry.*;
|
import io.gitlab.jfronny.respackopts.tree.*;
|
||||||
import io.gitlab.jfronny.respackopts.data.enums.PackReloadType;
|
import io.gitlab.jfronny.respackopts.data.enums.PackReloadType;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
|
@ -2,7 +2,7 @@ package io.gitlab.jfronny.respackopts.gson.entry;
|
||||||
|
|
||||||
import com.google.gson.*;
|
import com.google.gson.*;
|
||||||
import io.gitlab.jfronny.respackopts.Respackopts;
|
import io.gitlab.jfronny.respackopts.Respackopts;
|
||||||
import io.gitlab.jfronny.respackopts.data.entry.ConfigEnumEntry;
|
import io.gitlab.jfronny.respackopts.tree.ConfigEnumEntry;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package io.gitlab.jfronny.respackopts.gson.entry;
|
package io.gitlab.jfronny.respackopts.gson.entry;
|
||||||
|
|
||||||
import com.google.gson.*;
|
import com.google.gson.*;
|
||||||
import io.gitlab.jfronny.respackopts.data.entry.ConfigNumericEntry;
|
import io.gitlab.jfronny.respackopts.tree.ConfigNumericEntry;
|
||||||
import io.gitlab.jfronny.respackopts.data.enums.NumericEntryType;
|
import io.gitlab.jfronny.respackopts.data.enums.NumericEntryType;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package io.gitlab.jfronny.respackopts.data.entry;
|
package io.gitlab.jfronny.respackopts.tree;
|
||||||
|
|
||||||
import io.gitlab.jfronny.respackopts.Respackopts;
|
import io.gitlab.jfronny.respackopts.Respackopts;
|
||||||
import me.shedaniel.clothconfig2.api.AbstractConfigListEntry;
|
import me.shedaniel.clothconfig2.api.AbstractConfigListEntry;
|
|
@ -1,4 +1,4 @@
|
||||||
package io.gitlab.jfronny.respackopts.data.entry;
|
package io.gitlab.jfronny.respackopts.tree;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
|
@ -1,4 +1,4 @@
|
||||||
package io.gitlab.jfronny.respackopts.data.entry;
|
package io.gitlab.jfronny.respackopts.tree;
|
||||||
|
|
||||||
import io.gitlab.jfronny.respackopts.Respackopts;
|
import io.gitlab.jfronny.respackopts.Respackopts;
|
||||||
import io.gitlab.jfronny.respackopts.data.enums.ConfigSyncMode;
|
import io.gitlab.jfronny.respackopts.data.enums.ConfigSyncMode;
|
|
@ -1,16 +1,13 @@
|
||||||
package io.gitlab.jfronny.respackopts.data.entry;
|
package io.gitlab.jfronny.respackopts.tree;
|
||||||
|
|
||||||
|
import io.gitlab.jfronny.respackopts.Respackopts;
|
||||||
import io.gitlab.jfronny.respackopts.data.enums.ConfigSyncMode;
|
import io.gitlab.jfronny.respackopts.data.enums.ConfigSyncMode;
|
||||||
import io.gitlab.jfronny.respackopts.util.GuiFactory;
|
import io.gitlab.jfronny.respackopts.util.GuiFactory;
|
||||||
import io.gitlab.jfronny.respackopts.Respackopts;
|
|
||||||
import me.shedaniel.clothconfig2.api.AbstractConfigListEntry;
|
import me.shedaniel.clothconfig2.api.AbstractConfigListEntry;
|
||||||
import me.shedaniel.clothconfig2.impl.builders.DropdownMenuBuilder;
|
|
||||||
import meteordevelopment.starscript.value.Value;
|
import meteordevelopment.starscript.value.Value;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
public class ConfigEnumEntry extends ConfigEntry<String> {
|
public class ConfigEnumEntry extends ConfigEntry<String> {
|
||||||
|
@ -123,13 +120,20 @@ public class ConfigEnumEntry extends ConfigEntry<String> {
|
||||||
@Override
|
@Override
|
||||||
public AbstractConfigListEntry<?> buildEntry(GuiEntryBuilderParam guiEntryBuilderParam) {
|
public AbstractConfigListEntry<?> buildEntry(GuiEntryBuilderParam guiEntryBuilderParam) {
|
||||||
Function<String, Text> entryText = s -> GuiFactory.getText(s, ("".equals(guiEntryBuilderParam.translationPrefix()) ? "" : guiEntryBuilderParam.translationPrefix() + ".") + guiEntryBuilderParam.entryName());
|
Function<String, Text> entryText = s -> GuiFactory.getText(s, ("".equals(guiEntryBuilderParam.translationPrefix()) ? "" : guiEntryBuilderParam.translationPrefix() + ".") + guiEntryBuilderParam.entryName());
|
||||||
return guiEntryBuilderParam.entryBuilder().startDropdownMenu(guiEntryBuilderParam.name(),
|
Map<String, String> translationReverseLookup = new HashMap<>();
|
||||||
DropdownMenuBuilder.TopCellElementBuilder.of(getValue(), s -> s, entryText),
|
for (String value : values) {
|
||||||
DropdownMenuBuilder.CellCreatorBuilder.of(entryText))
|
translationReverseLookup.put(entryText.apply(value).getString(), value);
|
||||||
|
}
|
||||||
|
return guiEntryBuilderParam.entryBuilder().startStringDropdownMenu(guiEntryBuilderParam.name(), entryText.apply(getValue()).getString(), entryText)
|
||||||
.setSuggestionMode(false)
|
.setSuggestionMode(false)
|
||||||
.setDefaultValue(getDefault())
|
.setDefaultValue(entryText.apply(getDefault()).getString())
|
||||||
.setSelections(() -> values.iterator())
|
.setSelections(translationReverseLookup.keySet())
|
||||||
.setSaveConsumer(value -> {
|
.setSaveConsumer(value -> {
|
||||||
|
if (!translationReverseLookup.containsKey(value)) {
|
||||||
|
Respackopts.LOGGER.error("Invalid enum entry selected: " + value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
value = translationReverseLookup.get(value);
|
||||||
if (!Objects.equals(getValue(), value)) {
|
if (!Objects.equals(getValue(), value)) {
|
||||||
if (Respackopts.CONFIG.debugLogs) Respackopts.LOGGER.info("ConfigEnumEntry SaveCallback");
|
if (Respackopts.CONFIG.debugLogs) Respackopts.LOGGER.info("ConfigEnumEntry SaveCallback");
|
||||||
guiEntryBuilderParam.saveCallback();
|
guiEntryBuilderParam.saveCallback();
|
|
@ -1,4 +1,4 @@
|
||||||
package io.gitlab.jfronny.respackopts.data.entry;
|
package io.gitlab.jfronny.respackopts.tree;
|
||||||
|
|
||||||
import io.gitlab.jfronny.respackopts.Respackopts;
|
import io.gitlab.jfronny.respackopts.Respackopts;
|
||||||
import io.gitlab.jfronny.respackopts.data.enums.ConfigSyncMode;
|
import io.gitlab.jfronny.respackopts.data.enums.ConfigSyncMode;
|
|
@ -1,4 +1,4 @@
|
||||||
package io.gitlab.jfronny.respackopts.data.entry;
|
package io.gitlab.jfronny.respackopts.tree;
|
||||||
|
|
||||||
import io.gitlab.jfronny.respackopts.data.enums.PackReloadType;
|
import io.gitlab.jfronny.respackopts.data.enums.PackReloadType;
|
||||||
import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
|
import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
|
|
@ -1,9 +1,9 @@
|
||||||
package io.gitlab.jfronny.respackopts.util;
|
package io.gitlab.jfronny.respackopts.util;
|
||||||
|
|
||||||
import io.gitlab.jfronny.respackopts.Respackopts;
|
import io.gitlab.jfronny.respackopts.Respackopts;
|
||||||
import io.gitlab.jfronny.respackopts.data.entry.ConfigBranch;
|
import io.gitlab.jfronny.respackopts.tree.ConfigBranch;
|
||||||
import io.gitlab.jfronny.respackopts.data.entry.ConfigEntry;
|
import io.gitlab.jfronny.respackopts.tree.ConfigEntry;
|
||||||
import io.gitlab.jfronny.respackopts.data.entry.GuiEntryBuilderParam;
|
import io.gitlab.jfronny.respackopts.tree.GuiEntryBuilderParam;
|
||||||
import io.gitlab.jfronny.respackopts.data.enums.PackReloadType;
|
import io.gitlab.jfronny.respackopts.data.enums.PackReloadType;
|
||||||
import io.gitlab.jfronny.respackopts.integration.DashLoaderCompat;
|
import io.gitlab.jfronny.respackopts.integration.DashLoaderCompat;
|
||||||
import me.shedaniel.clothconfig2.api.AbstractConfigListEntry;
|
import me.shedaniel.clothconfig2.api.AbstractConfigListEntry;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package io.gitlab.jfronny.respackopts.util;
|
package io.gitlab.jfronny.respackopts.util;
|
||||||
|
|
||||||
import io.gitlab.jfronny.respackopts.Respackopts;
|
import io.gitlab.jfronny.respackopts.Respackopts;
|
||||||
import io.gitlab.jfronny.respackopts.data.entry.ConfigBranch;
|
import io.gitlab.jfronny.respackopts.tree.ConfigBranch;
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.fabricmc.loader.api.ModContainer;
|
import net.fabricmc.loader.api.ModContainer;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
|
|
@ -35,10 +35,5 @@
|
||||||
},
|
},
|
||||||
"conflicts": {
|
"conflicts": {
|
||||||
"libjf": "<2.0"
|
"libjf": "<2.0"
|
||||||
},
|
|
||||||
"custom": {
|
|
||||||
"libjf": {
|
|
||||||
"asm.export": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package io.gitlab.jfronny.respackopts;
|
package io.gitlab.jfronny.respackopts;
|
||||||
|
|
||||||
import io.gitlab.jfronny.respackopts.data.ConfigFile;
|
import io.gitlab.jfronny.respackopts.data.ConfigFile;
|
||||||
import io.gitlab.jfronny.respackopts.data.entry.*;
|
import io.gitlab.jfronny.respackopts.tree.*;
|
||||||
import io.gitlab.jfronny.respackopts.data.enums.ConfigSyncMode;
|
import io.gitlab.jfronny.respackopts.data.enums.ConfigSyncMode;
|
||||||
import io.gitlab.jfronny.respackopts.data.enums.NumericEntryType;
|
import io.gitlab.jfronny.respackopts.data.enums.NumericEntryType;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user