mirror of
https://github.com/PaperMC/Paper.git
synced 2026-11-25 10:29:41 -05:00
Stop converting ItemStack to nms ItemStack by hand
This should fix many issues with enchantments being lost, as the method used takes care of enchantments. Additionally, use the new nms ItemStack constructor in places where appropriate. Fixes (at least part of) BUKKIT-7. Need to identify any further places to fix.
This commit is contained in:
1 parent
d34e289434
commit
82965eb10f
5 files changed
+11
-30
No files matched your search
@@ -80,11 +80,7 @@ public class EntityCow extends EntityAnimal {
|
||||
return false;
|
||||
}
|
||||
|
||||
CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
|
||||
byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
|
||||
itemstack = new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data);
|
||||
|
||||
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, itemstack);
|
||||
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, CraftItemStack.createNMSItemStack(event.getItemStack()));
|
||||
// CraftBukkit end
|
||||
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user