mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-05 02:22:12 +01:00
#1324: Improve ItemFactory#enchantItem consistency
By: Miles Holder <mwholder2005@gmail.com>
This commit is contained in:
parent
8cd8851498
commit
19e69bb8fc
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) {
|
private static ItemStack enchantItem(RandomSource source, ItemStack itemStack, int level, boolean allowTreasures) {
|
||||||
Preconditions.checkArgument(itemStack != null, "ItemStack must not be null");
|
Preconditions.checkArgument(itemStack != null, "ItemStack must not be null");
|
||||||
Preconditions.checkArgument(!itemStack.getType().isAir(), "ItemStack must not be air");
|
Preconditions.checkArgument(!itemStack.getType().isAir(), "ItemStack must not be air");
|
||||||
|
itemStack = CraftItemStack.asCraftCopy(itemStack);
|
||||||
if (!(itemStack instanceof CraftItemStack)) {
|
|
||||||
itemStack = CraftItemStack.asCraftCopy(itemStack);
|
|
||||||
}
|
|
||||||
|
|
||||||
CraftItemStack craft = (CraftItemStack) itemStack;
|
CraftItemStack craft = (CraftItemStack) itemStack;
|
||||||
EnchantmentManager.enchantItem(source, craft.handle, level, allowTreasures);
|
return CraftItemStack.asCraftMirror(EnchantmentManager.enchantItem(source, craft.handle, level, allowTreasures));
|
||||||
return craft;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue