Class MappingDataLoader
java.lang.Object
com.viaversion.viaversion.api.data.MappingDataLoader
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
static interface
MappingDataLoader.MappingsSupplier<T extends Mappings,
V> -
Field Summary
Modifier and TypeFieldDescriptionstatic final MappingDataLoader
static final com.viaversion.nbt.io.TagReader<com.viaversion.nbt.tag.CompoundTag>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionit.unimi.dsi.fastutil.objects.Object2IntMap<String>
arrayToMap
(com.google.gson.JsonArray array) Returns a map of the array entries hashed by their id value.void
@Nullable InputStream
getResource
(String name) @Nullable String
identifierFromGlobalId
(String registry, int globalId) Returns the global id of the identifier in the registry.identifiersFromGlobalIds
(com.viaversion.nbt.tag.CompoundTag mappingsTag, String key) it.unimi.dsi.fastutil.objects.Object2IntMap<String>
indexedObjectToMap
(com.google.gson.JsonObject object) Returns a map of the object entries hashed by their id value.@Nullable com.google.gson.JsonObject
Loads the file from the bundled resources.@Nullable com.google.gson.JsonObject
loadFromDataDir
(String name) Loads the file from the plugin folder if present, else from the bundled resources.static void
@Nullable Mappings
loadMappings
(com.viaversion.nbt.tag.CompoundTag mappingsTag, String key) loadMappings
(com.viaversion.nbt.tag.CompoundTag mappingsTag, String key, MappingDataLoader.MappingHolderSupplier<V> holderSupplier, MappingDataLoader.AddConsumer<V> addConsumer, MappingDataLoader.MappingsSupplier<M, V> mappingsSupplier) @Nullable com.viaversion.nbt.tag.CompoundTag
@Nullable com.viaversion.nbt.tag.CompoundTag
@Nullable com.viaversion.nbt.tag.CompoundTag
loadNBTFromFile
(String name)
-
Field Details
-
INSTANCE
-
MAPPINGS_READER
public static final com.viaversion.nbt.io.TagReader<com.viaversion.nbt.tag.CompoundTag> MAPPINGS_READER
-
-
Constructor Details
-
MappingDataLoader
-
-
Method Details
-
loadGlobalIdentifiers
public static void loadGlobalIdentifiers() -
identifierFromGlobalId
Returns the global id of the identifier in the registry.- Parameters:
registry
- registry keyglobalId
- global id- Returns:
- identifier
- Throws:
IllegalArgumentException
- if the registry key is invalid
-
clearCache
public void clearCache() -
loadFromDataDir
Loads the file from the plugin folder if present, else from the bundled resources.- Returns:
- loaded json object, or null if not found or invalid
-
loadData
Loads the file from the bundled resources.- Returns:
- loaded json object from bundled resources if present
-
loadNBT
-
loadNBT
-
loadNBTFromFile
-
loadMappings
-
loadMappings
@Beta public <M extends Mappings,V> @Nullable Mappings loadMappings(com.viaversion.nbt.tag.CompoundTag mappingsTag, String key, MappingDataLoader.MappingHolderSupplier<V> holderSupplier, MappingDataLoader.AddConsumer<V> addConsumer, MappingDataLoader.MappingsSupplier<M, V> mappingsSupplier) -
identifiersFromGlobalIds
-
indexedObjectToMap
public it.unimi.dsi.fastutil.objects.Object2IntMap<String> indexedObjectToMap(com.google.gson.JsonObject object) Returns a map of the object entries hashed by their id value.- Parameters:
object
- json object- Returns:
- map with indexes hashed by their id value
-
arrayToMap
public it.unimi.dsi.fastutil.objects.Object2IntMap<String> arrayToMap(com.google.gson.JsonArray array) Returns a map of the array entries hashed by their id value.- Parameters:
array
- json array- Returns:
- map with indexes hashed by their id value
-
getLogger
-
getDataFolder
-
getResource
-