mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2025-08-31 22:30:15 +00:00
#1324: Improve ItemFactory#enchantItem consistency
This commit is contained in:
parent
4e419c774c
commit
9fde4c037c
1 changed files with 2 additions and 7 deletions
|
@ -489,13 +489,8 @@ public final class CraftItemFactory implements ItemFactory {
|
|||
private static ItemStack enchantItem(RandomSource source, ItemStack itemStack, int level, boolean allowTreasures) {
|
||||
Preconditions.checkArgument(itemStack != null, "ItemStack must not be null");
|
||||
Preconditions.checkArgument(!itemStack.getType().isAir(), "ItemStack must not be air");
|
||||
|
||||
if (!(itemStack instanceof CraftItemStack)) {
|
||||
itemStack = CraftItemStack.asCraftCopy(itemStack);
|
||||
}
|
||||
|
||||
itemStack = CraftItemStack.asCraftCopy(itemStack);
|
||||
CraftItemStack craft = (CraftItemStack) itemStack;
|
||||
EnchantmentManager.enchantItem(source, craft.handle, level, allowTreasures);
|
||||
return craft;
|
||||
return CraftItemStack.asCraftMirror(EnchantmentManager.enchantItem(source, craft.handle, level, allowTreasures));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue