public void interact(EntityPlayer player) {
    // can't interact if liquid inside
    if (tank.getFluidAmount() > 0) {
      return;
    }

    // completely empty -> insert current item into input
    if (!isStackInSlot(0) && !isStackInSlot(1)) {
      ItemStack stack =
          player.inventory.decrStackSize(player.inventory.currentItem, stackSizeLimit);
      setInventorySlotContents(0, stack);
    }
    // take item out
    else {
      // take out of stack 1 if something is in there, 0 otherwise
      int slot = isStackInSlot(1) ? 1 : 0;

      // Additional Info: Only 1 item can only be put into the casting block usually, however
      // recipes
      // can have Itemstacks with stacksize > 1 as output
      // we therefore spill the whole contents on extraction
      ItemStack stack = getStackInSlot(slot);
      if (slot == 1) {
        FMLCommonHandler.instance().firePlayerSmeltedEvent(player, stack);
      }
      PlayerHelper.spawnItemAtPlayer(player, stack);
      setInventorySlotContents(slot, null);
    }
  }
  @Override
  public boolean onBlockActivated(
      World worldIn,
      BlockPos pos,
      IBlockState state,
      EntityPlayer player,
      EnumFacing side,
      float hitX,
      float hitY,
      float hitZ) {
    // we allow to insert buckets into the smeltery
    TileEntity te = worldIn.getTileEntity(pos);
    if (!(te instanceof IFluidHandler)) {
      return false;
    }
    IFluidHandler tank = (IFluidHandler) te;
    side = side.getOpposite();

    ItemStack stack = player.getHeldItem();
    if (stack == null) {
      return false;
    }

    // regular bucket
    ItemStack result = FluidUtil.tryEmptyBucket(stack, tank, side);
    if (result != null) {
      if (!player.capabilities.isCreativeMode) {
        player.inventory.decrStackSize(player.inventory.currentItem, 1);
        PlayerHelper.spawnItemAtPlayer(player, result);
      }
      return true;
    }

    // universal bucket
    ItemStack copy = stack.copy();
    if (FluidUtil.tryEmptyFluidContainerItem(stack, tank, side, player)) {
      if (player.capabilities.isCreativeMode) {
        // reset the stack that got modified
        player.inventory.setInventorySlotContents(player.inventory.currentItem, copy);
      }
      return true;
    }

    // prevent interaction of the item if it's a fluidcontainer. Prevents placing liquids when
    // interacting with the tank
    return FluidContainerRegistry.isFilledContainer(stack)
        || stack.getItem() instanceof IFluidContainerItem;
  }