mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00: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.
This commit is contained in:
parent
e73b7f5941
commit
46cd26ffae
1 changed files with 5 additions and 0 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue