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
BiomeMaps are used to map data values to Biome constants.
We heavily utilise this method of data mapping for GEOResources, especially
when supporting multiple versions of Minecraft. This way, we can have different BiomeMaps
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
ConstructorsConstructorDescriptionBiomeMap(NamespacedKey namespacedKey) This constructs a newBiomeMapwith the givenNamespacedKey. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(Biome biome) booleancontainsValue(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) booleanisEmpty()This returns whether thisBiomeMapis empty.booleanvoidvoidbooleantoString()
-
Constructor Details
-
BiomeMap
This constructs a newBiomeMapwith the givenNamespacedKey.- Parameters:
namespacedKey- TheNamespacedKeyfor thisBiomeMap
-
-
Method Details
-
get
-
getOrDefault
-
containsKey
-
containsValue
-
isEmpty
public boolean isEmpty()- Returns:
- Whether this
BiomeMapis 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
-