mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 11:38:29 +01:00
Teach nms ItemStack constructor how to take enchantments
This commit is contained in:
parent
14754c71a2
commit
d34e289434
@ -39,6 +39,18 @@ public final class ItemStack {
|
|||||||
this.setData(k); // CraftBukkit
|
this.setData(k); // CraftBukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CraftBukkit - used to create a new ItemStack, specifying the enchantments at time of creation.
|
||||||
|
public ItemStack(int id, int count, int data, NBTTagList enchantments) {
|
||||||
|
this(id, count, data);
|
||||||
|
// taken from .addEnchantment
|
||||||
|
if (this.tag == null) {
|
||||||
|
this.setTag(new NBTTagCompound());
|
||||||
|
}
|
||||||
|
|
||||||
|
this.tag.set("ench", enchantments); // modify this part to use passed in enchantments list
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
public static ItemStack a(NBTTagCompound nbttagcompound) {
|
public static ItemStack a(NBTTagCompound nbttagcompound) {
|
||||||
ItemStack itemstack = new ItemStack();
|
ItemStack itemstack = new ItemStack();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user