mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 03:22:19 +01:00
Test cloning enchanted CraftItemStacks
By: Andrew Ardill <andrew.ardill@gmail.com>
This commit is contained in:
parent
c41cf92c61
commit
0b7a5891c5
1 changed files with 28 additions and 0 deletions
|
@ -0,0 +1,28 @@
|
|||
package org.bukkit.craftbukkit.inventory;
|
||||
|
||||
import net.minecraft.server.Enchantment;
|
||||
import net.minecraft.server.StatisticList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class CraftItemStackTest {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
StatisticList.a();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCloneEnchantedItem() throws Exception {
|
||||
net.minecraft.server.ItemStack nmsItemStack = new net.minecraft.server.ItemStack(net.minecraft.server.Item.POTION);
|
||||
nmsItemStack.addEnchantment(Enchantment.DAMAGE_ALL, 1);
|
||||
ItemStack itemStack = new CraftItemStack(nmsItemStack);
|
||||
ItemStack clone = itemStack.clone();
|
||||
assert (clone.getType().equals(itemStack.getType()));
|
||||
assert (clone.getAmount() == itemStack.getAmount());
|
||||
assert (clone.getDurability() == itemStack.getDurability());
|
||||
assert (clone.getEnchantments().equals(itemStack.getEnchantments()));
|
||||
assert (clone.getTypeId() == itemStack.getTypeId());
|
||||
assert (clone.getData().equals(itemStack.getData()));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue