3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 00:00:41 +01:00

Don't cache non-locale assets in the LocaleUtils asset cache

Previously Geyser was storing a reference of every single asset hash provided by the server, including things like sound files. We never used this files, and their existence caused the amount of Asset classes present in Geyser to be over 3000. With this change, we only cache the 118 language files.
Dieser Commit ist enthalten in:
Camotoy 2021-07-25 10:11:53 -04:00
Ursprung e73b7f5941
Commit 46cd26ffae
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F

Datei anzeigen

@ -98,6 +98,11 @@ public class LocaleUtils {
Iterator<Map.Entry<String, JsonNode>> assetIterator = assets.fields(); Iterator<Map.Entry<String, JsonNode>> assetIterator = assets.fields();
while (assetIterator.hasNext()) { while (assetIterator.hasNext()) {
Map.Entry<String, JsonNode> entry = assetIterator.next(); Map.Entry<String, JsonNode> entry = assetIterator.next();
if (!entry.getKey().startsWith("minecraft/lang/")) {
// No need to cache non-language assets as we don't use them
continue;
}
Asset asset = GeyserConnector.JSON_MAPPER.treeToValue(entry.getValue(), Asset.class); Asset asset = GeyserConnector.JSON_MAPPER.treeToValue(entry.getValue(), Asset.class);
ASSET_MAP.put(entry.getKey(), asset); ASSET_MAP.put(entry.getKey(), asset);
} }