-
Notifications
You must be signed in to change notification settings - Fork 0
dpconfig methods
A dpconfig method describes what value to modify and where to find it. It takes input from a dpconfig widget, and then uses that to change a value somewhere in the datapack.
A transformer transforms the input into a different value. If the users inputs, say, 1, i.e. "True", we can change that to, say, 76 - that's what the transformer does.
A transformer argument can either be an integer, a float, a function object, or a string.
In case of a string, the argument is taken literally. An argument of "my_mod:my_structure" will be just that. However, when the string is "input", the value will be the original user input, i.e. what you typed in the GUI.
Compares argument and argument1 together.
Uses the key if to decide how to compare. Value can be either == (full equality) or > (more than).
If the result is true, outputs value in key true. If false, outputs value in key false.
Rounds and converts argument into an integer.
Adds argument and argument1 together.
Multiplies argument by argument1.
Returns the argument squared.
Returns the square root of argument.
This transformer looks at whether the user input is equal to 2 when rounded, then outputs a string depending on the result.
"transformer": {
"function": "if_else",
"if": "==",
"argument": {
"function": "int",
"argument": "input"
},
"argument1": 2,
"true": "it is two!!!!!!!!!!!",
"false": "it is not two :("
},
An accessor describes how to change a value in a particular file. A method may have multiple accessors if it needs to change multiple different values in either one file or many.
An accessor is described by the following settings:
Describes the way the value should be modified by the input.
Can be multiply, add, subtract or set. Anything else will overwrite the value with the input.
-
multiplywill multiply the original value by the input. -
dividewill divide the original value by the input. -
addwill add the input to the original value. -
subtractwill subtract the input from the original value. -
setwill overwrite the value with the input. -
multiply_int- multiply the original value by the input, then convert to an integer. -
divide_int- do a full division, then convert to an integer. -
add_int- add, then convert to an integer. -
subtract_int- subtract, then convert to an integer. -
remove- remove a value from a list.
Either a single string or a list of strings describing the file path(s).
All files whose paths end in the described file_path will match and be edited.
For example, data/foo/bar/my_file.json is acceptable as a file path.
It will match files whose paths look like this: data/foo/bar/my_file.json AND this: overlay/data/foo/bar/my_file.json.
If overlay/data/foo/bar/my_file.json is used as a file path, only this one file will match.
my_file.json is also acceptable, but it will match every file named this way, which is potentially risky.
my_file is not acceptable as a file path.
The path to the key whose value we're trying to change in the JSON file, described with keys. The forward slash (/) is used as the dividing character.
For the sky color in a biome file it would look like this: effects/sky_color
If there's a list in the way, use an integer describing the index of the element. In a placed feature it might look like this: placement/3/max_water_depth