This variant of tag loading should be slightly more efficient

This commit is contained in:
Camotoy 2024-06-12 00:12:15 -04:00
parent 956a84a3fb
commit a42c979abb
No known key found for this signature in database
GPG Key ID: 7EEFB66FE798081F
1 changed files with 4 additions and 1 deletions

View File

@ -85,8 +85,8 @@ public final class TagCache {
} }
private <T extends Ordered> void loadTags(String type, @Nullable Map<String, int[]> packetTags, Map<String, T> allTags, int[][] localValues) { private <T extends Ordered> void loadTags(String type, @Nullable Map<String, int[]> packetTags, Map<String, T> allTags, int[][] localValues) {
Arrays.fill(localValues, IntArrays.EMPTY_ARRAY);
if (packetTags == null) { if (packetTags == null) {
Arrays.fill(localValues, IntArrays.EMPTY_ARRAY);
GeyserImpl.getInstance().getLogger().debug("Not loading " + type + " tags; they do not exist here."); GeyserImpl.getInstance().getLogger().debug("Not loading " + type + " tags; they do not exist here.");
return; return;
} }
@ -95,8 +95,11 @@ public final class TagCache {
if (values != null) { if (values != null) {
if (values.length != 0) { if (values.length != 0) {
localValues[tag.ordinal()] = values; localValues[tag.ordinal()] = values;
} else {
localValues[tag.ordinal()] = IntArrays.EMPTY_ARRAY;
} }
} else { } else {
localValues[tag.ordinal()] = IntArrays.EMPTY_ARRAY;
GeyserImpl.getInstance().getLogger().debug(type + " tag not found from server: " + location); GeyserImpl.getInstance().getLogger().debug(type + " tag not found from server: " + location);
} }
}); });