示例#1
0
 /**
  * Creates a new item stack derived from the specified stack
  *
  * @param stack the stack to copy
  * @throws IllegalArgumentException if the specified stack is null or returns an item meta not
  *     created by the item factory
  */
 public ItemStack(final ItemStack stack) throws IllegalArgumentException {
   Validate.notNull(stack, "Cannot copy null stack");
   this.type = stack.getTypeId();
   this.amount = stack.getAmount();
   this.durability = stack.getDurability();
   this.data = stack.getData();
   if (stack.hasItemMeta()) {
     setItemMeta0(stack.getItemMeta(), getType0());
   }
 }