13
0
geforkt von Mirrors/Paper

fix enchantment order issue

Dieser Commit ist enthalten in:
Jake Potrebic 2024-04-26 18:06:35 -07:00
Ursprung f6bd443ff2
Commit b1f19f295c

Datei anzeigen

@ -42,7 +42,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
BuiltInRegistries.ENCHANTMENT.holderByNameCodec(), LEVEL_CODEC
)
- .xmap(Object2IntOpenHashMap::new, Function.identity());
+ .xmap(Object2IntAVLTreeMap::new, Function.identity()); // Paper
+ // Paper start - sort enchantments
+ .xmap(m -> {
+ final Object2IntAVLTreeMap<Holder<Enchantment>> map = new Object2IntAVLTreeMap<>(ENCHANTMENT_ORDER);
+ map.putAll(m);
+ return map;
+ }, Function.identity());
+ // Paper end - sort enchantments
private static final Codec<ItemEnchantments> FULL_CODEC = RecordCodecBuilder.create(
instance -> instance.group(
LEVELS_CODEC.fieldOf("levels").forGetter(component -> component.enchantments),