From b1f19f295cc077b2359bc8d1f680c8dccf4c67cb Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Fri, 26 Apr 2024 18:06:35 -0700 Subject: [PATCH] fix enchantment order issue --- patches/server/Handle-Item-Meta-Inconsistencies.patch | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/patches/server/Handle-Item-Meta-Inconsistencies.patch b/patches/server/Handle-Item-Meta-Inconsistencies.patch index b1068b97fc..ee79467356 100644 --- a/patches/server/Handle-Item-Meta-Inconsistencies.patch +++ b/patches/server/Handle-Item-Meta-Inconsistencies.patch @@ -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> map = new Object2IntAVLTreeMap<>(ENCHANTMENT_ORDER); ++ map.putAll(m); ++ return map; ++ }, Function.identity()); ++ // Paper end - sort enchantments private static final Codec FULL_CODEC = RecordCodecBuilder.create( instance -> instance.group( LEVELS_CODEC.fieldOf("levels").forGetter(component -> component.enchantments),