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
ConstructorDescriptionBiomeMapParser
(NamespacedKey key, BiomeDataConverter<T> valueConverter) This constructs a newBiomeMapParser
. -
Method Summary
Modifier and TypeMethodDescriptionThis method builds aBiomeMap
based on the parsed data.boolean
This method returns whether this parser is flagged as "lenient".void
read
(com.google.gson.JsonArray json) void
void
setLenient
(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
- TheNamespacedKey
for the resultingBiomeMap
valueConverter
- A function to convertJsonElement
s 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
BiomeMapException
if theBiome
could 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
BiomeMapException
if theBiome
could 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 aBiomeMap
based on the parsed data.Make sure to parse data via
read(JsonArray)
orread(String)
before calling this method! Otherwise the resultingBiomeMap
will be empty.- Returns:
- The resulting
BiomeMap
-