Fix a few issues with ItemMeta (#10740)
This commit is contained in:
@@ -95,14 +95,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- ItemEnchantments list = CraftItemStack.getEnchantmentList(this.handle);
|
||||
- if (list == null) {
|
||||
- list = ItemEnchantments.EMPTY;
|
||||
- }
|
||||
+ // Paper start - Replace whole method
|
||||
+ final ItemMeta itemMeta = this.getItemMeta();
|
||||
+ if (itemMeta != null) {
|
||||
+ itemMeta.addEnchant(ench, level, true);
|
||||
+ this.setItemMeta(itemMeta);
|
||||
}
|
||||
- ItemEnchantments.Mutable listCopy = new ItemEnchantments.Mutable(list);
|
||||
- listCopy.set(CraftEnchantment.bukkitToMinecraft(ench), level);
|
||||
- this.handle.set(DataComponents.ENCHANTMENTS, listCopy.toImmutable());
|
||||
+ // Paper start - Replace whole method
|
||||
+ final ItemMeta itemMeta = this.getItemMeta();
|
||||
+ itemMeta.addEnchant(ench, level, true);
|
||||
+ this.setItemMeta(itemMeta);
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user