use of com.viaversion.viaversion.util.Int2IntBiHashMap in project ViaVersion by ViaVersion.
the class MappingDataBase method load.
@Override
public void load() {
getLogger().info("Loading " + oldVersion + " -> " + newVersion + " mappings...");
JsonObject diffmapping = hasDiffFile ? loadDiffFile() : null;
JsonObject oldMappings = MappingDataLoader.loadData("mapping-" + oldVersion + ".json", true);
JsonObject newMappings = MappingDataLoader.loadData("mapping-" + newVersion + ".json", true);
blockMappings = loadFromObject(oldMappings, newMappings, diffmapping, "blocks");
blockStateMappings = loadFromObject(oldMappings, newMappings, diffmapping, "blockstates");
blockEntityMappings = loadFromArray(oldMappings, newMappings, diffmapping, "blockentities");
soundMappings = loadFromArray(oldMappings, newMappings, diffmapping, "sounds");
statisticsMappings = loadFromArray(oldMappings, newMappings, diffmapping, "statistics");
Mappings particles = loadFromArray(oldMappings, newMappings, diffmapping, "particles");
if (particles != null) {
particleMappings = new ParticleMappings(oldMappings.getAsJsonArray("particles"), newMappings.getAsJsonArray("particles"), particles);
}
if (loadItems && newMappings.has("items")) {
itemMappings = new Int2IntBiHashMap();
itemMappings.defaultReturnValue(-1);
MappingDataLoader.mapIdentifiers(itemMappings, oldMappings.getAsJsonObject("items"), newMappings.getAsJsonObject("items"), diffmapping != null ? diffmapping.getAsJsonObject("items") : null, true);
}
if (diffmapping != null && diffmapping.has("tags")) {
this.tags = new EnumMap<>(RegistryType.class);
JsonObject tags = diffmapping.getAsJsonObject("tags");
if (tags.has(RegistryType.ITEM.resourceLocation())) {
loadTags(RegistryType.ITEM, tags, MappingDataLoader.indexedObjectToMap(newMappings.getAsJsonObject("items")));
}
if (tags.has(RegistryType.BLOCK.resourceLocation())) {
loadTags(RegistryType.BLOCK, tags, MappingDataLoader.indexedObjectToMap(newMappings.getAsJsonObject("blocks")));
}
}
loadExtras(oldMappings, newMappings, diffmapping);
}
Aggregations