From 087322f6cd9b2e61979c5561ab59a795e4ecd3a6 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 4 Jun 2024 00:01:59 -0400 Subject: [PATCH] Small set optimization --- .../org/geysermc/geyser/item/enchantment/Enchantment.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/item/enchantment/Enchantment.java b/core/src/main/java/org/geysermc/geyser/item/enchantment/Enchantment.java index 41cc36894..8d1d92f6c 100644 --- a/core/src/main/java/org/geysermc/geyser/item/enchantment/Enchantment.java +++ b/core/src/main/java/org/geysermc/geyser/item/enchantment/Enchantment.java @@ -66,16 +66,13 @@ public record Enchantment(String identifier, } private static Set readEnchantmentComponents(NbtMap effects) { - if (effects.isEmpty()) { - return Collections.emptySet(); - } Set components = new HashSet<>(); for (Map.Entry 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) {