Class MappingDataBase

  • All Implemented Interfaces:
    MappingData

    public class MappingDataBase
    extends java.lang.Object
    implements MappingData
    • Field Detail

      • oldVersion

        protected final java.lang.String oldVersion
      • newVersion

        protected final java.lang.String newVersion
      • hasDiffFile

        protected final boolean hasDiffFile
      • blockMappings

        protected Mappings blockMappings
      • blockStateMappings

        protected Mappings blockStateMappings
      • soundMappings

        protected Mappings soundMappings
      • statisticsMappings

        protected Mappings statisticsMappings
      • loadItems

        protected boolean loadItems
    • Constructor Detail

      • MappingDataBase

        public MappingDataBase​(java.lang.String oldVersion,
                               java.lang.String newVersion)
      • MappingDataBase

        public MappingDataBase​(java.lang.String oldVersion,
                               java.lang.String newVersion,
                               boolean hasDiffFile)
    • Method Detail

      • load

        public void load()
        Description copied from interface: MappingData
        Loads the mapping data.
        Specified by:
        load in interface MappingData
      • 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
      • 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
      • getTags

        public @Nullable java.util.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
      • loadFromArray

        protected @Nullable Mappings loadFromArray​(com.google.gson.JsonObject oldMappings,
                                                   com.google.gson.JsonObject newMappings,
                                                   @Nullable com.google.gson.JsonObject diffMappings,
                                                   java.lang.String key)
      • loadFromObject

        protected @Nullable Mappings loadFromObject​(com.google.gson.JsonObject oldMappings,
                                                    com.google.gson.JsonObject newMappings,
                                                    @Nullable com.google.gson.JsonObject diffMappings,
                                                    java.lang.String key)
      • loadDiffFile

        protected @Nullable com.google.gson.JsonObject loadDiffFile()
      • getLogger

        protected java.util.logging.Logger getLogger()
      • checkValidity

        protected int checkValidity​(int id,
                                    int mappedId,
                                    java.lang.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.google.gson.JsonObject oldMappings,
                                  com.google.gson.JsonObject newMappings,
                                  @Nullable com.google.gson.JsonObject diffMappings)
        To be overridden.
        Parameters:
        oldMappings - old mappings
        newMappings - new mappings
        diffMappings - diff mappings if present