/** Build and return a new {@link ItemStack}. */
  public ItemStack build() {

    ItemStack itemStack = new ItemStack(_materialData.getItemType());
    itemStack.setData(_materialData.clone());
    itemStack.setAmount(_amount);

    if (_durability != null) itemStack.setDurability(_durability);

    if (_display != null) ItemStackUtils.setDisplayName(itemStack, _display);

    if (_lore != null) ItemStackUtils.setLore(itemStack, _lore);

    if (_enchantments != null) {

      for (IEnchantmentLevel wrapper : _enchantments) {
        itemStack.addUnsafeEnchantment(wrapper.getEnchantment(), wrapper.getLevel());
      }
    }

    if (_color != null) {
      ItemStackUtils.setColor(itemStack, _color);
    }

    return itemStack;
  }
  public static boolean fillFluidHandlerWithPlayerItem(
      World world, IFluidHandler handler, EntityPlayer player, ItemStack equipped) {
    if (equipped == null) return false;

    FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(equipped);
    if (fluid != null) {
      if (handler.fill(null, fluid, false) == fluid.amount || player.capabilities.isCreativeMode) {
        if (world.isRemote) return true;

        ItemStack filledStack = FluidContainerRegistry.drainFluidContainer(equipped);
        if (!player.capabilities.isCreativeMode) {
          if (equipped.stackSize == 1) {
            player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
            player.inventory.addItemStackToInventory(filledStack);
          } else {
            equipped.stackSize -= 1;
            if (filledStack != null && !player.inventory.addItemStackToInventory(filledStack))
              player.dropItem(filledStack, false, true);
          }
          player.openContainer.detectAndSendChanges();
          if (player instanceof EntityPlayerMP)
            ((EntityPlayerMP) player)
                .updateCraftingInventory(player.openContainer, player.openContainer.getInventory());
        }
        handler.fill(null, fluid, true);
        return true;
      }
    } else if (equipped.getItem() instanceof IFluidContainerItem) {
      IFluidContainerItem container = (IFluidContainerItem) equipped.getItem();
      fluid = container.getFluid(equipped);
      if (handler.fill(null, fluid, false) > 0) {
        if (world.isRemote) return true;

        int fill = handler.fill(null, fluid, true);
        if (equipped.stackSize > 1) {
          ItemStack emptied = ItemStackUtils.copyStackWithAmount(equipped, 1);
          equipped.stackSize -= 1;
          container.drain(emptied, fill, true);
          if (!player.inventory.addItemStackToInventory(emptied))
            player.dropItem(emptied, false, true);
        } else container.drain(equipped, fill, true);
        player.openContainer.detectAndSendChanges();
        if (player instanceof EntityPlayerMP)
          ((EntityPlayerMP) player)
              .updateCraftingInventory(player.openContainer, player.openContainer.getInventory());
        return true;
      }
    }
    return false;
  }