Always write identifier-table output file

This commit is contained in:
Nassim Jahnke 2024-05-03 15:38:47 +02:00
parent faca5e1618
commit b6ce24c8bd
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
2 changed files with 27 additions and 25 deletions

View File

@ -1,58 +1,58 @@
{ {
"1.13": { "1.13": {
"object-hash": 1835999558, "object-hash": 1835999553,
"size": 94 "size": 94
}, },
"1.13.2": { "1.13.2": {
"object-hash": 214381667, "object-hash": 214381662,
"size": 192 "size": 192
}, },
"1.14": { "1.14": {
"object-hash": 1631090930, "object-hash": 1631090925,
"size": 570 "size": 570
}, },
"1.15": { "1.15": {
"object-hash": 667164485, "object-hash": 667164480,
"size": 594 "size": 594
}, },
"1.16": { "1.16": {
"object-hash": 978512762, "object-hash": 978512757,
"size": 1210 "size": 1210
}, },
"1.16.2": { "1.16.2": {
"object-hash": 1064891088, "object-hash": 1064891083,
"size": 1394 "size": 1394
}, },
"1.17": { "1.17": {
"object-hash": -1238441101, "object-hash": -1238441106,
"size": 2594 "size": 2594
}, },
"1.18": { "1.18": {
"object-hash": 521012559, "object-hash": 521012554,
"size": 2707 "size": 2707
}, },
"1.19": { "1.19": {
"object-hash": -929747200, "object-hash": -929747205,
"size": 3444 "size": 3444
}, },
"1.19.3": { "1.19.3": {
"object-hash": 537457037, "object-hash": 537457032,
"size": 3583 "size": 3583
}, },
"1.19.4": { "1.19.4": {
"object-hash": -2120264184, "object-hash": -2120264189,
"size": 4215 "size": 4215
}, },
"1.20": { "1.20": {
"object-hash": 1019999243, "object-hash": 1019999238,
"size": 4287 "size": 4287
}, },
"1.20.2": { "1.20.2": {
"object-hash": 1019999243, "object-hash": 1019999238,
"size": 4287 "size": 4287
}, },
"1.20.3": { "1.20.3": {
"object-hash": -898988321, "object-hash": -898988326,
"size": 4568 "size": 4568
}, },
"1.20.5": { "1.20.5": {
@ -60,11 +60,11 @@
"size": 4840 "size": 4840
}, },
"3D_Shareware": { "3D_Shareware": {
"object-hash": -639482332, "object-hash": -639482337,
"size": 972 "size": 972
}, },
"20w14infinite": { "20w14infinite": {
"object-hash": 682358467, "object-hash": 682358462,
"size": 1522 "size": 1522
}, },
"1.10:1.9.4": { "1.10:1.9.4": {
@ -220,11 +220,11 @@
"size": 4864 "size": 4864
}, },
"1.20.5:1.21": { "1.20.5:1.21": {
"object-hash": 1974034079, "object-hash": -1185141951,
"size": 344 "size": 312
}, },
"1.21:1.20.5": { "1.21:1.20.5": {
"object-hash": 1870030776, "object-hash": 655633032,
"size": 641 "size": 794
} }
} }

View File

@ -296,13 +296,14 @@ public final class MappingsOptimizer {
if (updatedGlobalIdentifiers) { if (updatedGlobalIdentifiers) {
// Also keep a json file around for easier viewing // Also keep a json file around for easier viewing
writeJson(globalIdentifiersObject, MAPPINGS_DIR.resolve("identifier-table.json")); writeJson(globalIdentifiersObject, MAPPINGS_DIR.resolve("identifier-table.json"));
final Path outputPath = OUTPUT_DIR.resolve(OUTPUT_GLOBAL_IDENTIFIERS_FILE);
final CompoundTag globalIdentifiersTag = (CompoundTag) JsonConverter.toTag(globalIdentifiersObject);
write(globalIdentifiersTag, outputPath);
updatedGlobalIdentifiers = false;
LOGGER.info("Updated global identifiers file"); LOGGER.info("Updated global identifiers file");
} }
// Always create output file
final Path outputPath = OUTPUT_DIR.resolve(OUTPUT_GLOBAL_IDENTIFIERS_FILE);
final CompoundTag globalIdentifiersTag = (CompoundTag) JsonConverter.toTag(globalIdentifiersObject);
write(globalIdentifiersTag, outputPath);
updatedGlobalIdentifiers = false;
} }
private static void addFileData(final String key, final int hash, final Path path) throws IOException { private static void addFileData(final String key, final int hash, final Path path) throws IOException {
@ -552,6 +553,7 @@ public final class MappingsOptimizer {
} }
// Use the same compact storage on the identifier->global identifier files, just about halves the size // Use the same compact storage on the identifier->global identifier files, just about halves the size
// TODO Omit mapped size?
final MappingsResult result = MappingsLoader.map(identifiers, globalIdentifiersArray, null, errorStrategy); final MappingsResult result = MappingsLoader.map(identifiers, globalIdentifiersArray, null, errorStrategy);
serialize(result, tag, key, true); serialize(result, tag, key, true);
} }