fixed some Equation#asString related stuff
This commit is contained in:
parent
47a96f87f7
commit
be4696aee5
4 changed files with 11 additions and 6 deletions
|
@ -286,7 +286,7 @@ public interface Equation {
|
|||
stringBuilder.append(",");
|
||||
argumentEquations[i].visit(stringBuilder);
|
||||
}
|
||||
return stringBuilder.append(functionString);
|
||||
return stringBuilder.append(")");
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,10 +75,12 @@ public abstract class PocketGenerator implements Weighted<PocketGenerationContex
|
|||
} catch (EquationParseException e) {
|
||||
LOGGER.error("Could not parse weight equation \"" + weight + "\", defaulting to default weight equation \"" + defaultWeightEquation + "\"", e);
|
||||
try {
|
||||
this.weightEquation = Equation.parse(defaultWeightEquation);
|
||||
// FIXME: do we actually want to have it serialize to the broken String equation we input?
|
||||
this.weightEquation = Equation.newEquation(Equation.parse(defaultWeightEquation)::apply, stringBuilder -> stringBuilder.append(weight));
|
||||
} catch (EquationParseException equationParseException) {
|
||||
LOGGER.error("Could not parse default weight equation \"" + defaultWeightEquation + "\", defaulting to fallback weight \"" + fallbackWeight + "\"", equationParseException);
|
||||
this.weightEquation = stringDoubleMap -> fallbackWeight;
|
||||
// FIXME: do we actually want to have it serialize to the broken String equation we input?
|
||||
this.weightEquation = Equation.newEquation(stringDoubleMap -> (double) fallbackWeight, stringBuilder -> stringBuilder.append(weight));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -222,7 +222,8 @@ public class ShellModifier implements LazyModifier {
|
|||
this.thicknessEquation = Equation.parse(thickness);
|
||||
} catch (Equation.EquationParseException e) {
|
||||
LOGGER.error("Could not parse layer thickness equation. Defaulting to 1");
|
||||
this.thicknessEquation = variableMap -> 1d;
|
||||
// FIXME: do we actually want to have it serialize to the broken String equation we input?
|
||||
this.thicknessEquation = Equation.newEquation(variableMap -> 1d, stringBuilder -> stringBuilder.append(thickness));
|
||||
}
|
||||
|
||||
this.blockState = SchematicBlockPalette.Entry.to(blockStateString).getOrThrow(false, LOGGER::error);
|
||||
|
|
|
@ -46,11 +46,13 @@ public abstract class PocketGeneratorReference implements ImplementedVirtualPock
|
|||
LOGGER.debug("Defaulting to default weight equation for {}", this);
|
||||
LOGGER.debug("Exception Stacktrace", e);
|
||||
try {
|
||||
this.weightEquation = Equation.parse(DimensionalDoorsInitializer.getConfig().getPocketsConfig().defaultWeightEquation);
|
||||
// FIXME: do we actually want to have it serialize to the broken String equation we input?
|
||||
this.weightEquation = Equation.newEquation(Equation.parse(DimensionalDoorsInitializer.getConfig().getPocketsConfig().defaultWeightEquation)::apply, stringBuilder -> stringBuilder.append(weight));
|
||||
} catch (EquationParseException equationParseException) {
|
||||
LOGGER.debug("Defaulting to default weight equation for {}", this);
|
||||
LOGGER.debug("Exception Stacktrace", e);
|
||||
this.weightEquation = stringDoubleMap -> DimensionalDoorsInitializer.getConfig().getPocketsConfig().fallbackWeight;
|
||||
// FIXME: do we actually want to have it serialize to the broken String equation we input?
|
||||
this.weightEquation = Equation.newEquation(stringDoubleMap -> (double) DimensionalDoorsInitializer.getConfig().getPocketsConfig().fallbackWeight, stringBuilder -> stringBuilder.append(weight));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue