Class BiomeMapParser<T>
java.lang.Object
io.github.thebusybiscuit.slimefun4.utils.biomes.BiomeMapParser<T>
- Type Parameters:
T- The data type of the resultingBiomeMap
The
BiomeMapParser allows you to parse json data into a BiomeMap.- Author:
- TheBusyBiscuit
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionBiomeMapParser(NamespacedKey key, BiomeDataConverter<T> valueConverter) This constructs a newBiomeMapParser. -
Method Summary
Modifier and TypeMethodDescriptionThis method builds aBiomeMapbased on the parsed data.booleanThis method returns whether this parser is flagged as "lenient".voidread(com.google.gson.JsonArray json) voidvoidsetLenient(boolean isLenient) This method sets the "lenient" flag for this parser.
-
Constructor Details
-
BiomeMapParser
@ParametersAreNonnullByDefault public BiomeMapParser(NamespacedKey key, BiomeDataConverter<T> valueConverter) This constructs a newBiomeMapParser.To parse data, use the
read(JsonArray)orread(String)method.- Parameters:
key- TheNamespacedKeyfor the resultingBiomeMapvalueConverter- A function to convertJsonElements into your desired data type
-
-
Method Details
-
setLenient
public void setLenient(boolean isLenient) This method sets the "lenient" flag for this parser.A lenient parser will not throw a
BiomeMapExceptionif theBiomecould not be found. The default value is false.- Parameters:
isLenient- Whether this parser should be lenient or not.
-
isLenient
public boolean isLenient()This method returns whether this parser is flagged as "lenient".A lenient parser will not throw a
BiomeMapExceptionif theBiomecould not be found. The default value is false.- Returns:
- Whether this parser is lenient or not.
-
read
- Throws:
BiomeMapException
-
read
- Throws:
BiomeMapException
-
buildBiomeMap
This method builds aBiomeMapbased on the parsed data.Make sure to parse data via
read(JsonArray)orread(String)before calling this method! Otherwise the resultingBiomeMapwill be empty.- Returns:
- The resulting
BiomeMap
-