Json
Builder to create an arbitrary loot condition through a JSON-based structure.
This builder allows to create arbitrary JSON structures, which can reference other mod-added loot conditions that do not provide native CraftTweaker support. The given JSON structure needs to be a valid JSON-object representation, meaning it needs to be an instance of MapData. The JSON may or may not specify the type. If the type is specified then it must match the one given in the builder; otherwise the type is automatically added.
The JSON structure along with the condition type is mandatory.
Diese Klasse importieren
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
Implemented Interfaces
Json implements the following interfaces. That means all methods defined in these interfaces are also available in Json
Methoden
Creates an ILootCondition of the given type
parsing the given json
.
The JSON must respect the constraints specified in the class documentation. It is suggested to use this method sparingly, preferring to instead create JSON conditions as needed from within a LootConditionBuilder.
If no valid condition is found, or the JSON is invalid, an error gets thrown.
This method is equivalent to makeJson
in LootConditionBuilder.
Returns: An ILootCondition instance built according to the given data, if possible. Return Type: ILootCondition
Creates an ILootCondition of the given type
parsing the given json
.
The name is treated as a MCResourceLocation, lacking the type safety of the bracket handler. For this reason, it's suggested to prefer the method with a MCResourceLocation as parameter.
The JSON must respect the constraints specified in the class documentation. It is suggested to use this method sparingly, preferring to instead create JSON conditions as needed from within a LootConditionBuilder.
If no valid condition is found, or the JSON is invalid, an error gets thrown.
This method is equivalent to makeJson
in LootConditionBuilder.
Returns: An ILootCondition instance built according to the given data, if possible. Return Type: ILootCondition
Methoden
Sets the type of the condition that will be built along with the JSON representation that will be parsed.
The JSON must respect the constraints specified in the class documentation.
Return Type: Json
Sets the type of the condition that will be built along with the JSON representation that will be parsed.
The name is treated as a MCResourceLocation, lacking the type safety of the bracket handler. For this reason, it's suggested to prefer the method with a MCResourceLocation as parameter.
The JSON must respect the constraints specified in the class documentation.
Return Type: Json