mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-29 19:51:30 +01:00
fix enchantment order issue
This commit is contained in:
parent
f6bd443ff2
commit
b1f19f295c
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user