3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-24 23:30:22 +01:00

Small set optimization

Dieser Commit ist enthalten in:
Camotoy 2024-06-04 00:01:59 -04:00
Ursprung 3ead9e94aa
Commit 087322f6cd
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F

Datei anzeigen

@ -66,16 +66,13 @@ public record Enchantment(String identifier,
}
private static Set<EnchantmentComponent> readEnchantmentComponents(NbtMap effects) {
if (effects.isEmpty()) {
return Collections.emptySet();
}
Set<EnchantmentComponent> components = new HashSet<>();
for (Map.Entry<String, Object> entry : effects.entrySet()) {
switch (entry.getKey()) {
case "minecraft:prevent_armor_change" -> components.add(EnchantmentComponent.PREVENT_ARMOR_CHANGE);
}
}
return components;
return Set.copyOf(components); // Also ensures any empty sets are consolidated
}
private static String readDescription(NbtMap tag) {