Class BiomeMap<T>
java.lang.Object
io.github.thebusybiscuit.slimefun4.utils.biomes.BiomeMap<T>
- Type Parameters:
T
- The stored data type
- All Implemented Interfaces:
Keyed
BiomeMap
s are used to map data values to Biome
constants.
We heavily utilise this method of data mapping for GEOResource
s, especially
when supporting multiple versions of Minecraft. This way, we can have different BiomeMap
s
for different versions of Minecraft, in case Biome
names change in-between versions.
The data type can be any type of Object
.
The most common type is Integer
, if you are using complex objects and try to read
your BiomeMap
from a JsonElement
, make sure to provide an adequate
BiomeDataConverter
to convert the raw json data.
- Author:
- TheBusyBiscuit
-
Constructor Summary
ConstructorDescriptionBiomeMap
(NamespacedKey namespacedKey) This constructs a newBiomeMap
with the givenNamespacedKey
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsKey
(Biome biome) boolean
containsValue
(T value) static <T> BiomeMap<T>
fromJson
(NamespacedKey key, String json, BiomeDataConverter<T> valueConverter) static <T> BiomeMap<T>
fromJson
(NamespacedKey key, String json, BiomeDataConverter<T> valueConverter, boolean isLenient) static <T> BiomeMap<T>
fromResource
(NamespacedKey key, JavaPlugin plugin, String path, BiomeDataConverter<T> valueConverter) getIntMapFromResource
(NamespacedKey key, JavaPlugin plugin, String path) getKey()
getLongMapFromResource
(NamespacedKey key, JavaPlugin plugin, String path) getOrDefault
(Biome biome, T defaultValue) getStringMapFromResource
(NamespacedKey key, JavaPlugin plugin, String path) boolean
isEmpty()
This returns whether thisBiomeMap
is empty.boolean
void
void
boolean
toString()
-
Constructor Details
-
BiomeMap
This constructs a newBiomeMap
with the givenNamespacedKey
.- Parameters:
namespacedKey
- TheNamespacedKey
for thisBiomeMap
-
-
Method Details
-
get
-
getOrDefault
-
containsKey
-
containsValue
-
isEmpty
public boolean isEmpty()- Returns:
- Whether this
BiomeMap
is empty.
-
put
-
putAll
-
putAll
-
remove
-
getKey
-
toString
-
fromJson
@Nonnull @ParametersAreNonnullByDefault public static <T> BiomeMap<T> fromJson(NamespacedKey key, String json, BiomeDataConverter<T> valueConverter) throws BiomeMapException - Throws:
BiomeMapException
-
fromJson
@Nonnull @ParametersAreNonnullByDefault public static <T> BiomeMap<T> fromJson(NamespacedKey key, String json, BiomeDataConverter<T> valueConverter, boolean isLenient) throws BiomeMapException - Throws:
BiomeMapException
-
fromResource
@Nonnull @ParametersAreNonnullByDefault public static <T> BiomeMap<T> fromResource(NamespacedKey key, JavaPlugin plugin, String path, BiomeDataConverter<T> valueConverter) throws BiomeMapException - Throws:
BiomeMapException
-
getIntMapFromResource
@ParametersAreNonnullByDefault @Nonnull public static BiomeMap<Integer> getIntMapFromResource(NamespacedKey key, JavaPlugin plugin, String path) throws BiomeMapException - Throws:
BiomeMapException
-
getLongMapFromResource
@ParametersAreNonnullByDefault @Nonnull public static BiomeMap<Long> getLongMapFromResource(NamespacedKey key, JavaPlugin plugin, String path) throws BiomeMapException - Throws:
BiomeMapException
-
getStringMapFromResource
@ParametersAreNonnullByDefault @Nonnull public static BiomeMap<String> getStringMapFromResource(NamespacedKey key, JavaPlugin plugin, String path) throws BiomeMapException - Throws:
BiomeMapException
-