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.
This commit is contained in:
Camotoy 2021-07-25 10:11:53 -04:00
parent e73b7f5941
commit 46cd26ffae
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F

View file

@ -98,6 +98,11 @@ public class LocaleUtils {
Iterator<Map.Entry<String, JsonNode>> assetIterator = assets.fields();
while (assetIterator.hasNext()) {
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_MAP.put(entry.getKey(), asset);
}