Class MappingDataBase

java.lang.Object
com.viaversion.viaversion.api.data.MappingDataBase
All Implemented Interfaces:
MappingData

public class MappingDataBase extends Object implements MappingData
  • Field Details

    • unmappedVersion

      protected final String unmappedVersion
    • mappedVersion

      protected final String mappedVersion
    • argumentTypeMappings

      protected FullMappings argumentTypeMappings
    • entityMappings

      protected FullMappings entityMappings
    • recipeSerializerMappings

      protected FullMappings recipeSerializerMappings
    • itemDataSerializerMappings

      protected FullMappings itemDataSerializerMappings
    • particleMappings

      protected ParticleMappings particleMappings
    • itemMappings

      protected BiMappings itemMappings
    • blockMappings

      protected BiMappings blockMappings
    • attributeMappings

      protected BiMappings attributeMappings
    • blockStateMappings

      protected Mappings blockStateMappings
    • blockEntityMappings

      protected Mappings blockEntityMappings
    • soundMappings

      protected Mappings soundMappings
    • statisticsMappings

      protected Mappings statisticsMappings
    • enchantmentMappings

      protected Mappings enchantmentMappings
    • paintingMappings

      protected Mappings paintingMappings
    • tags

      protected Map<RegistryType,List<TagData>> tags
  • Constructor Details

    • MappingDataBase

      public MappingDataBase(String unmappedVersion, String mappedVersion)
  • Method Details

    • load

      public void load()
      Description copied from interface: MappingData
      Loads the mapping data.
      Specified by:
      load in interface MappingData
    • identifiersFromGlobalIds

      protected @Nullable List<String> identifiersFromGlobalIds(com.viaversion.nbt.tag.CompoundTag mappingsTag, String key)
    • readMappingsFile

      protected @Nullable com.viaversion.nbt.tag.CompoundTag readMappingsFile(String name)
    • readUnmappedIdentifiersFile

      protected @Nullable com.viaversion.nbt.tag.CompoundTag readUnmappedIdentifiersFile(String name)
    • readMappedIdentifiersFile

      protected @Nullable com.viaversion.nbt.tag.CompoundTag readMappedIdentifiersFile(String name)
    • loadMappings

      protected @Nullable Mappings loadMappings(com.viaversion.nbt.tag.CompoundTag data, String key)
    • loadFullMappings

      protected @Nullable FullMappings loadFullMappings(com.viaversion.nbt.tag.CompoundTag data, com.viaversion.nbt.tag.CompoundTag unmappedIdentifiersTag, com.viaversion.nbt.tag.CompoundTag mappedIdentifiersTag, String key)
    • loadBiMappings

      protected @Nullable BiMappings loadBiMappings(com.viaversion.nbt.tag.CompoundTag data, String key)
    • getNewBlockStateId

      public int getNewBlockStateId(int id)
      Description copied from interface: MappingData
      Returns the mapped block state id, or -1 if unmapped.
      Specified by:
      getNewBlockStateId in interface MappingData
      Parameters:
      id - unmapped block state id
      Returns:
      mapped block state id, or -1 if unmapped
    • getNewBlockId

      public int getNewBlockId(int id)
      Description copied from interface: MappingData
      Returns the mapped block id, or -1 if unmapped.
      Specified by:
      getNewBlockId in interface MappingData
      Parameters:
      id - unmapped block id
      Returns:
      mapped block id, or -1 if unmapped
    • getOldBlockId

      public int getOldBlockId(int id)
      Specified by:
      getOldBlockId in interface MappingData
    • getNewItemId

      public int getNewItemId(int id)
      Description copied from interface: MappingData
      Returns the mapped item id, or -1 if unmapped.
      Specified by:
      getNewItemId in interface MappingData
      Parameters:
      id - unmapped item id
      Returns:
      mapped item id, or -1 if unmapped
    • getOldItemId

      public int getOldItemId(int id)
      Description copied from interface: MappingData
      Returns the backwards mapped item id, or -1 if unmapped.
      Specified by:
      getOldItemId in interface MappingData
      Parameters:
      id - mapped item id
      Returns:
      backwards mapped item id, or -1 if unmapped
    • getNewParticleId

      public int getNewParticleId(int id)
      Description copied from interface: MappingData
      Returns the mapped particle id, or -1 if unmapped.
      Specified by:
      getNewParticleId in interface MappingData
      Parameters:
      id - unmapped particle id
      Returns:
      mapped particle id, or -1 if unmapped
    • getNewAttributeId

      public int getNewAttributeId(int id)
      Specified by:
      getNewAttributeId in interface MappingData
    • getTags

      public @Nullable List<TagData> getTags(RegistryType type)
      Description copied from interface: MappingData
      Returns a list of tags to send if present.
      Specified by:
      getTags in interface MappingData
      Parameters:
      type - registry tag type
      Returns:
      list of tags to send if present, else null
    • getItemMappings

      public @Nullable BiMappings getItemMappings()
      Description copied from interface: MappingData
      Returns item mappings.
      Specified by:
      getItemMappings in interface MappingData
      Returns:
      item mappings
    • getFullItemMappings

      public @Nullable FullMappings getFullItemMappings()
      Description copied from interface: MappingData
      Returns item mappings if they also have identifier data present.
      Specified by:
      getFullItemMappings in interface MappingData
      Returns:
      item mappings if they also have identifier data present
      See Also:
    • getParticleMappings

      public @Nullable ParticleMappings getParticleMappings()
      Specified by:
      getParticleMappings in interface MappingData
    • getBlockMappings

      public @Nullable Mappings getBlockMappings()
      Specified by:
      getBlockMappings in interface MappingData
    • getBlockEntityMappings

      public @Nullable Mappings getBlockEntityMappings()
      Specified by:
      getBlockEntityMappings in interface MappingData
    • getBlockStateMappings

      public @Nullable Mappings getBlockStateMappings()
      Specified by:
      getBlockStateMappings in interface MappingData
    • getSoundMappings

      public @Nullable Mappings getSoundMappings()
      Specified by:
      getSoundMappings in interface MappingData
    • getStatisticsMappings

      public @Nullable Mappings getStatisticsMappings()
      Specified by:
      getStatisticsMappings in interface MappingData
    • getMenuMappings

      public @Nullable Mappings getMenuMappings()
      Specified by:
      getMenuMappings in interface MappingData
    • getEnchantmentMappings

      public @Nullable Mappings getEnchantmentMappings()
      Specified by:
      getEnchantmentMappings in interface MappingData
    • getAttributeMappings

      public @Nullable Mappings getAttributeMappings()
      Specified by:
      getAttributeMappings in interface MappingData
    • getEntityMappings

      public @Nullable FullMappings getEntityMappings()
      Specified by:
      getEntityMappings in interface MappingData
    • getArgumentTypeMappings

      public @Nullable FullMappings getArgumentTypeMappings()
      Specified by:
      getArgumentTypeMappings in interface MappingData
    • getDataComponentSerializerMappings

      public @Nullable FullMappings getDataComponentSerializerMappings()
      Specified by:
      getDataComponentSerializerMappings in interface MappingData
    • getPaintingMappings

      public @Nullable Mappings getPaintingMappings()
      Specified by:
      getPaintingMappings in interface MappingData
    • getRecipeSerializerMappings

      public @Nullable FullMappings getRecipeSerializerMappings()
      Specified by:
      getRecipeSerializerMappings in interface MappingData
    • getLogger

      protected Logger getLogger()
    • checkValidity

      protected int checkValidity(int id, int mappedId, String type)
      Returns the given mapped id if valid, else 0 with a warning logged to the console.
      Parameters:
      id - unmapped id
      mappedId - mapped id
      type - mapping type (e.g. "item")
      Returns:
      the given mapped id if valid, else 0
    • loadExtras

      protected void loadExtras(com.viaversion.nbt.tag.CompoundTag data)