Configurable default and fallback weight
This commit is contained in:
parent
192ea1dcf1
commit
a7cf93f3dd
3 changed files with 8 additions and 4 deletions
|
@ -82,6 +82,8 @@ public final class ModConfig implements ConfigData {
|
|||
@Tooltip public int maxPocketSize = 15;
|
||||
@Tooltip public int privatePocketSize = 2;
|
||||
@Tooltip public int publicPocketSize = 1;
|
||||
@Tooltip public String defaultWeightEquation = "5";
|
||||
@Tooltip public int fallbackWeight = 5;
|
||||
}
|
||||
|
||||
public static class World {
|
||||
|
|
|
@ -32,8 +32,6 @@ import net.minecraft.nbt.ListTag;
|
|||
|
||||
public abstract class PocketGeneratorReference extends VirtualSingularPocket {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final String defaultWeightEquation = "5"; // TODO: make config
|
||||
private static final int fallbackWeight = 5; // TODO: make config
|
||||
|
||||
protected String weight;
|
||||
protected Equation weightEquation;
|
||||
|
@ -48,11 +46,11 @@ public abstract class PocketGeneratorReference extends VirtualSingularPocket {
|
|||
LOGGER.debug("Defaulting to default weight equation for {}", this);
|
||||
LOGGER.debug("Exception Stacktrace", e);
|
||||
try {
|
||||
this.weightEquation = Equation.parse(defaultWeightEquation);
|
||||
this.weightEquation = Equation.parse(DimensionalDoorsInitializer.getConfig().getPocketsConfig().defaultWeightEquation);
|
||||
} catch (EquationParseException equationParseException) {
|
||||
LOGGER.debug("Defaulting to default weight equation for {}", this);
|
||||
LOGGER.debug("Exception Stacktrace", e);
|
||||
this.weightEquation = stringDoubleMap -> fallbackWeight;
|
||||
this.weightEquation = stringDoubleMap -> DimensionalDoorsInitializer.getConfig().getPocketsConfig().fallbackWeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,6 +161,10 @@
|
|||
"text.autoconfig.dimdoors.option.pockets.privatePocketSize@Tooltip": "Sets the minimum size of a newly created Private Pocket. If this is set to any value bigger than maxPocketSize, the value of maxPocketSize will be used instead.",
|
||||
"text.autoconfig.dimdoors.option.pockets.publicPocketSize": "Public Pocket Size",
|
||||
"text.autoconfig.dimdoors.option.pockets.publicPocketSize@Tooltip": "Sets the minimum size of a newly created Public Pocket. If this is set to any value bigger than privatePocketSize, the value of privatePocketSize will be used instead.",
|
||||
"text.autoconfig.dimdoors.option.pockets.defaultWeightEquation": "Default Weight Equation",
|
||||
"text.autoconfig.dimdoors.option.pockets.defaultWeightEquation@Tooltip": "Sets the equation to be used to compute weight when there is no / invalid weight equation present in the pocket generator json",
|
||||
"text.autoconfig.dimdoors.option.pockets.fallbackWeight": "Fallback weight",
|
||||
"text.autoconfig.dimdoors.option.pockets.fallbackWeight@Tooltip": "Sets the fallback weight to be used if the default weight equation fails.",
|
||||
"dimdoors.pocket.dyeAlreadyAbsorbed": "The pocket is already that color, so the rift didn't absorb the dye.",
|
||||
"dimdoors.pocket.pocketHasBeenDyed": "The pocket has been dyed %s.",
|
||||
"dimdoors.pocket.remainingNeededDyes": "The pocket has %s/%s of the dyes needed to be colored %s.",
|
||||
|
|
Loading…
Reference in a new issue