3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 08:30:09 +01:00

try to eat less ram

Dieser Commit ist enthalten in:
creeper123123321 2018-11-11 11:57:33 -02:00
Ursprung 1a3170c7db
Commit cfd3179cb8
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 0AC57D54786721D1
2 geänderte Dateien mit 1081 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -49,7 +49,8 @@ public class MappingData {
Via.getPlatform().getLogger().info("Loading sound mapping..."); Via.getPlatform().getLogger().info("Loading sound mapping...");
soundMappings = new SoundMappingShortArray(mapping1_12.getAsJsonArray("sounds"), mapping1_13.getAsJsonArray("sounds")); soundMappings = new SoundMappingShortArray(mapping1_12.getAsJsonArray("sounds"), mapping1_13.getAsJsonArray("sounds"));
Via.getPlatform().getLogger().info("Loading translation mappping"); Via.getPlatform().getLogger().info("Loading translation mappping");
translateMapping = GsonUtil.getGson().fromJson( translateMapping = new HashMap<>();
Map<String, String> translateData = GsonUtil.getGson().fromJson(
new InputStreamReader( new InputStreamReader(
MappingData.class.getClassLoader() MappingData.class.getClassLoader()
.getResourceAsStream("assets/viaversion/data/mapping-lang-1.12-1.13.json") .getResourceAsStream("assets/viaversion/data/mapping-lang-1.12-1.13.json")
@ -65,8 +66,15 @@ public class MappingData {
if (line.isEmpty()) continue; if (line.isEmpty()) continue;
String[] keyAndTranslation = line.split("=", 2); String[] keyAndTranslation = line.split("=", 2);
if (keyAndTranslation.length != 2) continue; if (keyAndTranslation.length != 2) continue;
if (!translateMapping.containsKey(keyAndTranslation[0])) { String key = keyAndTranslation[0];
translateMapping.put(keyAndTranslation[0], keyAndTranslation[1]); String translation = keyAndTranslation[1];
if (!translateData.containsKey(key)) {
translateMapping.put(key, translation);
} else {
String dataValue = translateData.get(keyAndTranslation[0]);
if (dataValue != null) {
translateMapping.put(key, dataValue);
}
} }
} }
} catch (IOException e) { } catch (IOException e) {