Example #1
0
  /** @return a Item Stack item with all attributes and flag data assigned to it. */
  public ItemStack getItem() {
    // clone the "clean" item
    ItemStack clone = this.item.clone();

    // assign attribute data to it
    for (ItemAttr itemAttr : this.attr.values()) {
      try {
        // try assign the attribute
        itemAttr.onAssign(clone);
      } catch (InvalidItemException e) {
        debugMsgItem(itemAttr.getInfo());
      }
    }

    for (ItemFlag flag : flags.values()) {
      try {
        // try assign the flag
        flag.onAssign(clone);
      } catch (InvalidItemException e) {
        debugMsgItem(flag.getInfo());
      }
    }
    // returns the valid item
    return clone;
  }