Update for changes in μScript
This commit is contained in:
parent
23e81eccf3
commit
6d8c06f26d
@ -6,7 +6,7 @@ maven_group=io.gitlab.jfronny
|
|||||||
archives_base_name=respackopts
|
archives_base_name=respackopts
|
||||||
fabric_version=0.55.0+1.19
|
fabric_version=0.55.0+1.19
|
||||||
jfapi_version=2.8.1-1654289121
|
jfapi_version=2.8.1-1654289121
|
||||||
muscript_version=2022.6.4+17-30-50
|
muscript_version=2022.6.7+11-38-13
|
||||||
|
|
||||||
modrinth_id=TiF5QWZY
|
modrinth_id=TiF5QWZY
|
||||||
modrinth_required_dependencies=P7dR8mSH, 9s6osm5g, WKwQAwke
|
modrinth_required_dependencies=P7dR8mSH, 9s6osm5g, WKwQAwke
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package io.gitlab.jfronny.respackopts;
|
package io.gitlab.jfronny.respackopts;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.*;
|
import io.gitlab.jfronny.gson.*;
|
||||||
import io.gitlab.jfronny.muscript.compiler.*;
|
import io.gitlab.jfronny.muscript.compiler.expr.*;
|
||||||
import io.gitlab.jfronny.respackopts.filters.*;
|
import io.gitlab.jfronny.respackopts.filters.*;
|
||||||
import io.gitlab.jfronny.respackopts.gson.*;
|
import io.gitlab.jfronny.respackopts.gson.*;
|
||||||
import io.gitlab.jfronny.respackopts.gson.entry.*;
|
import io.gitlab.jfronny.respackopts.gson.entry.*;
|
||||||
@ -46,8 +46,8 @@ public class Respackopts implements ClientModInitializer {
|
|||||||
.registerTypeAdapter(ConfigBooleanEntry.class, new BooleanEntrySerializer())
|
.registerTypeAdapter(ConfigBooleanEntry.class, new BooleanEntrySerializer())
|
||||||
.registerTypeAdapter(ConfigBranch.class, new ConfigBranchSerializer())
|
.registerTypeAdapter(ConfigBranch.class, new ConfigBranchSerializer())
|
||||||
.registerTypeAdapter(Expr.class, new ExprDeserializer())
|
.registerTypeAdapter(Expr.class, new ExprDeserializer())
|
||||||
.registerTypeAdapter(Expr.StringExpr.class, new ExprDeserializer.StringX())
|
.registerTypeAdapter(StringExpr.class, new StringExprDeserializer())
|
||||||
.registerTypeAdapter(Expr.BoolExpr.class, new BoolExprDeserializer())
|
.registerTypeAdapter(BoolExpr.class, new BoolExprDeserializer())
|
||||||
.setLenient()
|
.setLenient()
|
||||||
.setPrettyPrinting()
|
.setPrettyPrinting()
|
||||||
.create();
|
.create();
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package io.gitlab.jfronny.respackopts.filters.util;
|
package io.gitlab.jfronny.respackopts.filters.util;
|
||||||
|
|
||||||
import io.gitlab.jfronny.muscript.*;
|
import io.gitlab.jfronny.muscript.compiler.expr.*;
|
||||||
import io.gitlab.jfronny.muscript.compiler.*;
|
import io.gitlab.jfronny.muscript.dynamic.*;
|
||||||
import io.gitlab.jfronny.muscript.optic.*;
|
|
||||||
import io.gitlab.jfronny.respackopts.*;
|
import io.gitlab.jfronny.respackopts.*;
|
||||||
import io.gitlab.jfronny.respackopts.util.*;
|
import io.gitlab.jfronny.respackopts.util.*;
|
||||||
import net.minecraft.resource.*;
|
import net.minecraft.resource.*;
|
||||||
@ -11,9 +10,9 @@ import java.io.*;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class FileExpansionProvider {
|
public class FileExpansionProvider {
|
||||||
public static synchronized InputStream replace(OAny<?> parameter, InputStream is, Map<String, Expr.StringExpr> expansions) throws IOException {
|
public static synchronized InputStream replace(Dynamic<?> parameter, InputStream is, Map<String, StringExpr> expansions) throws IOException {
|
||||||
String s = new String(is.readAllBytes());
|
String s = new String(is.readAllBytes());
|
||||||
for (Map.Entry<String, Expr.StringExpr> entry : expansions.entrySet()) {
|
for (Map.Entry<String, StringExpr> entry : expansions.entrySet()) {
|
||||||
s = s.replace("${" + entry.getKey() + "}", entry.getValue().get(parameter));
|
s = s.replace("${" + entry.getKey() + "}", entry.getValue().get(parameter));
|
||||||
}
|
}
|
||||||
return new ByteArrayInputStream(s.getBytes());
|
return new ByteArrayInputStream(s.getBytes());
|
||||||
|
@ -4,15 +4,18 @@ import io.gitlab.jfronny.gson.*;
|
|||||||
import io.gitlab.jfronny.gson.reflect.*;
|
import io.gitlab.jfronny.gson.reflect.*;
|
||||||
import io.gitlab.jfronny.muscript.compiler.*;
|
import io.gitlab.jfronny.muscript.compiler.*;
|
||||||
import io.gitlab.jfronny.muscript.compiler.expr.*;
|
import io.gitlab.jfronny.muscript.compiler.expr.*;
|
||||||
|
import io.gitlab.jfronny.muscript.compiler.expr.bool.*;
|
||||||
|
import io.gitlab.jfronny.muscript.compiler.expr.common.*;
|
||||||
|
import io.gitlab.jfronny.muscript.compiler.expr.dynamic.*;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class BoolExprDeserializer implements JsonDeserializer<Expr.BoolExpr> {
|
public class BoolExprDeserializer implements JsonDeserializer<BoolExpr> {
|
||||||
private static final Type conditionListType = new TypeToken<List<Expr.BoolExpr>>(){}.getType();
|
private static final Type conditionListType = new TypeToken<List<BoolExpr>>(){}.getType();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Expr.BoolExpr deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
public BoolExpr deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||||
if (AttachmentHolder.getAttachedVersion() > 7) {
|
if (AttachmentHolder.getAttachedVersion() > 7) {
|
||||||
return ((Expr<?>)context.deserialize(json, Expr.class)).asBoolExpr();
|
return ((Expr<?>)context.deserialize(json, Expr.class)).asBoolExpr();
|
||||||
}
|
}
|
||||||
@ -53,29 +56,31 @@ public class BoolExprDeserializer implements JsonDeserializer<Expr.BoolExpr> {
|
|||||||
throw new JsonParseException("Invalid data type for condition");
|
throw new JsonParseException("Invalid data type for condition");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Expr.BoolExpr merge(List<Expr.BoolExpr> expressions, Token token) {
|
private BoolExpr merge(List<BoolExpr> expressions, Token token) {
|
||||||
Expr.BoolExpr current = expressions.get(0);
|
BoolExpr current = expressions.get(0);
|
||||||
for (Expr.BoolExpr expr : expressions.subList(1, expressions.size())) {
|
for (BoolExpr expr : expressions.subList(1, expressions.size())) {
|
||||||
current = switch (token) {
|
current = switch (token) {
|
||||||
case EqualEqual -> new Equal(current, expr);
|
case EqualEqual -> new Equal(current, expr);
|
||||||
case BangEqual -> new Not(new Equal(current, expr));
|
case BangEqual -> new Not(new Equal(current, expr));
|
||||||
default -> new LogicBiExpr(current, expr, token);
|
case And -> new And(current, expr);
|
||||||
|
case Or -> new Or(current, expr);
|
||||||
|
default -> throw new IllegalArgumentException();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Expr.BoolExpr rpoBooleanCondition(String name) {
|
private BoolExpr rpoBooleanCondition(String name) {
|
||||||
if (name.startsWith("modversion:")) {
|
if (name.startsWith("modversion:")) {
|
||||||
String code = name.substring("modversion:".length());
|
String code = name.substring("modversion:".length());
|
||||||
String mod = code.substring(0, code.indexOf(':'));
|
String mod = code.substring(0, code.indexOf(':'));
|
||||||
String predicate = code.substring(code.indexOf(':') + 1);
|
String predicate = code.substring(code.indexOf(':') + 1);
|
||||||
return new Call(new Variable("version"), List.of(
|
return new Call(new Variable("version"), List.of(
|
||||||
Expr.literal(mod).asObjectExpr(),
|
Expr.literal(mod).asDynamicExpr(),
|
||||||
Expr.literal(predicate).asObjectExpr()
|
Expr.literal(predicate).asDynamicExpr()
|
||||||
)).asBoolExpr();
|
)).asBoolExpr();
|
||||||
}
|
}
|
||||||
Expr.ObjectExpr e = null;
|
DynamicExpr e = null;
|
||||||
String[] arr = name.split("[:.]");
|
String[] arr = name.split("[:.]");
|
||||||
for (int i = 0; i < arr.length; i++) {
|
for (int i = 0; i < arr.length; i++) {
|
||||||
if (i == 0) e = new Variable(arr[i]);
|
if (i == 0) e = new Variable(arr[i]);
|
||||||
|
@ -3,6 +3,7 @@ package io.gitlab.jfronny.respackopts.gson;
|
|||||||
import io.gitlab.jfronny.gson.*;
|
import io.gitlab.jfronny.gson.*;
|
||||||
import io.gitlab.jfronny.muscript.*;
|
import io.gitlab.jfronny.muscript.*;
|
||||||
import io.gitlab.jfronny.muscript.compiler.*;
|
import io.gitlab.jfronny.muscript.compiler.*;
|
||||||
|
import io.gitlab.jfronny.muscript.compiler.expr.*;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -30,12 +31,4 @@ public class ExprDeserializer implements JsonDeserializer<Expr<?>> {
|
|||||||
throw new JsonParseException("Could not parse script: Expected string");
|
throw new JsonParseException("Could not parse script: Expected string");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class StringX implements JsonDeserializer<Expr.StringExpr> {
|
|
||||||
@Override
|
|
||||||
public Expr.StringExpr deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
|
|
||||||
Expr<?> expr = jsonDeserializationContext.deserialize(jsonElement, Expr.class);
|
|
||||||
return expr.asStringExpr();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package io.gitlab.jfronny.respackopts.gson;
|
||||||
|
|
||||||
|
import io.gitlab.jfronny.gson.*;
|
||||||
|
import io.gitlab.jfronny.muscript.compiler.expr.*;
|
||||||
|
|
||||||
|
import java.lang.reflect.*;
|
||||||
|
|
||||||
|
public class StringExprDeserializer implements JsonDeserializer<StringExpr> {
|
||||||
|
@Override
|
||||||
|
public StringExpr deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
|
||||||
|
Expr<?> expr = jsonDeserializationContext.deserialize(jsonElement, Expr.class);
|
||||||
|
return expr.asStringExpr();
|
||||||
|
}
|
||||||
|
}
|
@ -2,11 +2,11 @@ package io.gitlab.jfronny.respackopts.model;
|
|||||||
|
|
||||||
import com.google.gson.annotations.*;
|
import com.google.gson.annotations.*;
|
||||||
import io.gitlab.jfronny.commons.serialize.gson.api.*;
|
import io.gitlab.jfronny.commons.serialize.gson.api.*;
|
||||||
import io.gitlab.jfronny.muscript.compiler.*;
|
import io.gitlab.jfronny.muscript.compiler.expr.*;
|
||||||
|
|
||||||
public class DirRpo {
|
public class DirRpo {
|
||||||
@SerializedName(value = "condition", alternate = {"conditions"})
|
@SerializedName(value = "condition", alternate = {"conditions"})
|
||||||
public Expr.BoolExpr condition;
|
public BoolExpr condition;
|
||||||
@SerializedName(value = "fallback", alternate = {"fallbacks"})
|
@SerializedName(value = "fallback", alternate = {"fallbacks"})
|
||||||
public String fallback;
|
public String fallback;
|
||||||
|
|
||||||
|
@ -2,17 +2,17 @@ package io.gitlab.jfronny.respackopts.model;
|
|||||||
|
|
||||||
import com.google.gson.annotations.*;
|
import com.google.gson.annotations.*;
|
||||||
import io.gitlab.jfronny.commons.serialize.gson.api.*;
|
import io.gitlab.jfronny.commons.serialize.gson.api.*;
|
||||||
import io.gitlab.jfronny.muscript.compiler.*;
|
import io.gitlab.jfronny.muscript.compiler.expr.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class FileRpo {
|
public class FileRpo {
|
||||||
@SerializedName(value = "condition", alternate = {"conditions"})
|
@SerializedName(value = "condition", alternate = {"conditions"})
|
||||||
public Expr.BoolExpr condition;
|
public BoolExpr condition;
|
||||||
@SerializedName(value = "fallback", alternate = {"fallbacks"})
|
@SerializedName(value = "fallback", alternate = {"fallbacks"})
|
||||||
public Set<String> fallbacks;
|
public Set<String> fallbacks;
|
||||||
@SerializedName(value = "expansion", alternate = {"expansions"})
|
@SerializedName(value = "expansion", alternate = {"expansions"})
|
||||||
public Map<String, Expr.StringExpr> expansions;
|
public Map<String, StringExpr> expansions;
|
||||||
|
|
||||||
@Ignore
|
@Ignore
|
||||||
public String path;
|
public String path;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package io.gitlab.jfronny.respackopts.model.cache;
|
package io.gitlab.jfronny.respackopts.model.cache;
|
||||||
|
|
||||||
import io.gitlab.jfronny.muscript.*;
|
import io.gitlab.jfronny.muscript.*;
|
||||||
import io.gitlab.jfronny.muscript.optic.*;
|
import io.gitlab.jfronny.muscript.dynamic.*;
|
||||||
import io.gitlab.jfronny.respackopts.model.DirRpo;
|
import io.gitlab.jfronny.respackopts.model.DirRpo;
|
||||||
import io.gitlab.jfronny.respackopts.model.FileRpo;
|
import io.gitlab.jfronny.respackopts.model.FileRpo;
|
||||||
import io.gitlab.jfronny.respackopts.model.PackMeta;
|
import io.gitlab.jfronny.respackopts.model.PackMeta;
|
||||||
@ -28,6 +28,6 @@ public record CachedPackState(
|
|||||||
meta,
|
meta,
|
||||||
new HashMap<>(),
|
new HashMap<>(),
|
||||||
new HashMap<>(),
|
new HashMap<>(),
|
||||||
new ExpressionParameter(new HashMap<>(branch.getOptic().getValue())));
|
new ExpressionParameter(new HashMap<>(branch.getDynamic().getValue())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.gitlab.jfronny.respackopts.model.tree;
|
package io.gitlab.jfronny.respackopts.model.tree;
|
||||||
|
|
||||||
import io.gitlab.jfronny.muscript.optic.*;
|
import io.gitlab.jfronny.muscript.dynamic.*;
|
||||||
import io.gitlab.jfronny.respackopts.Respackopts;
|
import io.gitlab.jfronny.respackopts.Respackopts;
|
||||||
import me.shedaniel.clothconfig2.api.AbstractConfigListEntry;
|
import me.shedaniel.clothconfig2.api.AbstractConfigListEntry;
|
||||||
|
|
||||||
@ -29,8 +29,8 @@ public class ConfigBooleanEntry extends ConfigEntry<Boolean> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OAny<?> getOptic() {
|
public DBool getDynamic() {
|
||||||
return (OBool) this::getValue;
|
return this::getValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,7 +2,7 @@ package io.gitlab.jfronny.respackopts.model.tree;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import io.gitlab.jfronny.gson.reflect.TypeToken;
|
import io.gitlab.jfronny.gson.reflect.TypeToken;
|
||||||
import io.gitlab.jfronny.muscript.optic.*;
|
import io.gitlab.jfronny.muscript.dynamic.*;
|
||||||
import io.gitlab.jfronny.respackopts.Respackopts;
|
import io.gitlab.jfronny.respackopts.Respackopts;
|
||||||
import io.gitlab.jfronny.respackopts.model.enums.ConfigSyncMode;
|
import io.gitlab.jfronny.respackopts.model.enums.ConfigSyncMode;
|
||||||
import io.gitlab.jfronny.respackopts.util.IndentingStringBuilder;
|
import io.gitlab.jfronny.respackopts.util.IndentingStringBuilder;
|
||||||
@ -112,12 +112,12 @@ public class ConfigBranch extends ConfigEntry<Map<String, ConfigEntry<?>>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OObject getOptic() {
|
public DObject getDynamic() {
|
||||||
Map<String, OAny<?>> map = new HashMap<>();
|
Map<String, Dynamic<?>> map = new HashMap<>();
|
||||||
for (Map.Entry<String, ConfigEntry<?>> e : super.getValue().entrySet()) {
|
for (Map.Entry<String, ConfigEntry<?>> e : super.getValue().entrySet()) {
|
||||||
map.put(Respackopts.sanitizeString(e.getKey()), e.getValue().getOptic());
|
map.put(Respackopts.sanitizeString(e.getKey()), e.getValue().getDynamic());
|
||||||
}
|
}
|
||||||
return OFinal.of(map);
|
return DFinal.of(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.gitlab.jfronny.respackopts.model.tree;
|
package io.gitlab.jfronny.respackopts.model.tree;
|
||||||
|
|
||||||
import io.gitlab.jfronny.muscript.optic.*;
|
import io.gitlab.jfronny.muscript.dynamic.*;
|
||||||
import io.gitlab.jfronny.respackopts.Respackopts;
|
import io.gitlab.jfronny.respackopts.Respackopts;
|
||||||
import io.gitlab.jfronny.respackopts.model.enums.ConfigSyncMode;
|
import io.gitlab.jfronny.respackopts.model.enums.ConfigSyncMode;
|
||||||
import io.gitlab.jfronny.respackopts.model.enums.PackReloadType;
|
import io.gitlab.jfronny.respackopts.model.enums.PackReloadType;
|
||||||
@ -102,7 +102,7 @@ public abstract class ConfigEntry<T> {
|
|||||||
|
|
||||||
public abstract void buildShader(StringBuilder sb, String valueName);
|
public abstract void buildShader(StringBuilder sb, String valueName);
|
||||||
|
|
||||||
public abstract OAny<?> getOptic();
|
public abstract Dynamic<?> getDynamic();
|
||||||
|
|
||||||
public abstract AbstractConfigListEntry<?> buildEntry(GuiEntryBuilderParam guiEntryBuilderParam);
|
public abstract AbstractConfigListEntry<?> buildEntry(GuiEntryBuilderParam guiEntryBuilderParam);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.gitlab.jfronny.respackopts.model.tree;
|
package io.gitlab.jfronny.respackopts.model.tree;
|
||||||
|
|
||||||
import io.gitlab.jfronny.muscript.optic.*;
|
import io.gitlab.jfronny.muscript.dynamic.*;
|
||||||
import io.gitlab.jfronny.respackopts.*;
|
import io.gitlab.jfronny.respackopts.*;
|
||||||
import io.gitlab.jfronny.respackopts.model.enums.*;
|
import io.gitlab.jfronny.respackopts.model.enums.*;
|
||||||
import io.gitlab.jfronny.respackopts.util.*;
|
import io.gitlab.jfronny.respackopts.util.*;
|
||||||
@ -113,8 +113,8 @@ public class ConfigEnumEntry extends ConfigEntry<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OAny<?> getOptic() {
|
public DEnum getDynamic() {
|
||||||
return new OEnum(values, getValue());
|
return new DEnum(values, getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.gitlab.jfronny.respackopts.model.tree;
|
package io.gitlab.jfronny.respackopts.model.tree;
|
||||||
|
|
||||||
import io.gitlab.jfronny.muscript.optic.*;
|
import io.gitlab.jfronny.muscript.dynamic.*;
|
||||||
import io.gitlab.jfronny.respackopts.Respackopts;
|
import io.gitlab.jfronny.respackopts.Respackopts;
|
||||||
import io.gitlab.jfronny.respackopts.model.enums.ConfigSyncMode;
|
import io.gitlab.jfronny.respackopts.model.enums.ConfigSyncMode;
|
||||||
import io.gitlab.jfronny.respackopts.model.enums.NumericEntryType;
|
import io.gitlab.jfronny.respackopts.model.enums.NumericEntryType;
|
||||||
@ -67,8 +67,8 @@ public class ConfigNumericEntry extends ConfigEntry<Double> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OAny<?> getOptic() {
|
public DNumber getDynamic() {
|
||||||
return (ONumber) this::getValue;
|
return this::getValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,7 +2,7 @@ package io.gitlab.jfronny.respackopts.util;
|
|||||||
|
|
||||||
import io.gitlab.jfronny.commons.throwable.*;
|
import io.gitlab.jfronny.commons.throwable.*;
|
||||||
import io.gitlab.jfronny.muscript.*;
|
import io.gitlab.jfronny.muscript.*;
|
||||||
import io.gitlab.jfronny.muscript.optic.*;
|
import io.gitlab.jfronny.muscript.dynamic.*;
|
||||||
import io.gitlab.jfronny.respackopts.*;
|
import io.gitlab.jfronny.respackopts.*;
|
||||||
import io.gitlab.jfronny.respackopts.model.*;
|
import io.gitlab.jfronny.respackopts.model.*;
|
||||||
import io.gitlab.jfronny.respackopts.model.cache.*;
|
import io.gitlab.jfronny.respackopts.model.cache.*;
|
||||||
@ -139,10 +139,10 @@ public class MetaCache {
|
|||||||
MetaCache.forEach((id, state) -> {
|
MetaCache.forEach((id, state) -> {
|
||||||
String key = Respackopts.sanitizeString(state.packId());
|
String key = Respackopts.sanitizeString(state.packId());
|
||||||
if (!parameter.has(key))
|
if (!parameter.has(key))
|
||||||
parameter.set(key, state.configBranch().getOptic());
|
parameter.set(key, state.configBranch().getDynamic());
|
||||||
});
|
});
|
||||||
StandardLib.addTo(parameter);
|
StandardLib.addTo(parameter);
|
||||||
parameter.set("version", OFinal.of(args -> {
|
parameter.set("version", DFinal.of(args -> {
|
||||||
if (args.size() != 2) throw new IllegalArgumentException("Expected 2 arguments on version but got " + args.size());
|
if (args.size() != 2) throw new IllegalArgumentException("Expected 2 arguments on version but got " + args.size());
|
||||||
VersionPredicate predicate;
|
VersionPredicate predicate;
|
||||||
try {
|
try {
|
||||||
@ -150,7 +150,7 @@ public class MetaCache {
|
|||||||
} catch (VersionParsingException e) {
|
} catch (VersionParsingException e) {
|
||||||
throw new RuntimeException("Could not parse version predicate", e);
|
throw new RuntimeException("Could not parse version predicate", e);
|
||||||
}
|
}
|
||||||
return OFinal.of(FabricLoader.getInstance().getModContainer(args.get(0).asString().getValue())
|
return DFinal.of(FabricLoader.getInstance().getModContainer(args.get(0).asString().getValue())
|
||||||
.map(c -> predicate.test(c.getMetadata().getVersion()))
|
.map(c -> predicate.test(c.getMetadata().getVersion()))
|
||||||
.orElse(false));
|
.orElse(false));
|
||||||
}));
|
}));
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package io.gitlab.jfronny.respackopts;
|
package io.gitlab.jfronny.respackopts;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.*;
|
import io.gitlab.jfronny.gson.*;
|
||||||
import io.gitlab.jfronny.muscript.compiler.*;
|
|
||||||
import io.gitlab.jfronny.respackopts.gson.*;
|
import io.gitlab.jfronny.respackopts.gson.*;
|
||||||
import io.gitlab.jfronny.respackopts.gson.entry.*;
|
import io.gitlab.jfronny.respackopts.gson.entry.*;
|
||||||
import io.gitlab.jfronny.respackopts.model.*;
|
|
||||||
import io.gitlab.jfronny.respackopts.model.tree.*;
|
import io.gitlab.jfronny.respackopts.model.tree.*;
|
||||||
|
|
||||||
public class TemplateTree {
|
public class TemplateTree {
|
||||||
@ -14,7 +12,7 @@ public class TemplateTree {
|
|||||||
.registerTypeAdapter(ConfigBooleanEntry.class, new BooleanEntrySerializer())
|
.registerTypeAdapter(ConfigBooleanEntry.class, new BooleanEntrySerializer())
|
||||||
.registerTypeAdapter(ConfigBranch.class, new ConfigBranchSerializer())
|
.registerTypeAdapter(ConfigBranch.class, new ConfigBranchSerializer())
|
||||||
.registerTypeAdapter(Expr.class, new ExprDeserializer())
|
.registerTypeAdapter(Expr.class, new ExprDeserializer())
|
||||||
.registerTypeAdapter(Expr.StringExpr.class, new ExprDeserializer.StringX())
|
.registerTypeAdapter(Expr.StringExpr.class, new StringExprDeserializer())
|
||||||
.registerTypeAdapter(Expr.BoolExpr.class, new BoolExprDeserializer())
|
.registerTypeAdapter(Expr.BoolExpr.class, new BoolExprDeserializer())
|
||||||
.setLenient()
|
.setLenient()
|
||||||
.setPrettyPrinting()
|
.setPrettyPrinting()
|
||||||
|
Loading…
Reference in New Issue
Block a user