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

Enchantment tag can be null

Dieser Commit ist enthalten in:
Camotoy 2024-06-11 10:47:26 -04:00
Ursprung d19807170d
Commit 956a84a3fb
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F

Datei anzeigen

@ -26,6 +26,7 @@
package org.geysermc.geyser.session.cache; package org.geysermc.geyser.session.cache;
import it.unimi.dsi.fastutil.ints.IntArrays; import it.unimi.dsi.fastutil.ints.IntArrays;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.GeyserLogger; import org.geysermc.geyser.GeyserLogger;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
@ -83,8 +84,12 @@ public final class TagCache {
loadTags("Enchantment", enchantmentTags, ALL_ENCHANTMENT_TAGS, this.enchantments); loadTags("Enchantment", enchantmentTags, ALL_ENCHANTMENT_TAGS, this.enchantments);
} }
private <T extends Ordered> void loadTags(String type, 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); Arrays.fill(localValues, IntArrays.EMPTY_ARRAY);
if (packetTags == null) {
GeyserImpl.getInstance().getLogger().debug("Not loading " + type + " tags; they do not exist here.");
return;
}
allTags.forEach((location, tag) -> { allTags.forEach((location, tag) -> {
int[] values = packetTags.get(location); int[] values = packetTags.get(location);
if (values != null) { if (values != null) {