@Override
 protected ItemStack dispenseStack(IBlockSource dispenser, ItemStack dispensedItem) {
   EnumFacing enumfacing = BlockDispenser.func_149937_b(dispenser.getBlockMetadata());
   World world = dispenser.getWorld();
   int i = dispenser.getXInt() + enumfacing.getFrontOffsetX();
   int j = dispenser.getYInt() + enumfacing.getFrontOffsetY();
   int k = dispenser.getZInt() + enumfacing.getFrontOffsetZ();
   EntityTinyTNTPrimed primedTinyTNTEntity =
       new EntityTinyTNTPrimed(world, i + 0.5F, j + 0.5F, k + 0.5F, null);
   world.spawnEntityInWorld(primedTinyTNTEntity);
   --dispensedItem.stackSize;
   return dispensedItem;
 }
  @Override
  public ItemStack dispenseStack(IBlockSource block, ItemStack stack) {
    EnumFacing enumfacing = BlockDispenser.func_149937_b(block.getBlockMetadata());
    double d0 = block.getX() + enumfacing.getFrontOffsetX();
    double d1 = block.getYInt() + 0.2F;
    double d2 = block.getZ() + enumfacing.getFrontOffsetZ();
    Entity entity = ItemEntityEgg.spawnEntity(block.getWorld(), stack.getItemDamage(), d0, d1, d2);

    if (entity instanceof EntityLivingBase && stack.hasDisplayName())
      ((EntityLiving) entity).setCustomNameTag(stack.getDisplayName());

    stack.splitStack(1);
    return stack;
  }
 public ItemStack dispenseItem(ItemStack it, boolean sim) {
   ForgeDirection side = getSideFacing();
   TileEntity te =
       worldObj.getTileEntity(xCoord + side.offsetX, yCoord + side.offsetY, zCoord + side.offsetZ);
   if (te != null && te instanceof IInventory) {
     ItemStack rem = ItemUtil.addItemToNearbyInventories(this, it, false, sim, side);
     return rem;
   } else {
     if (!sim) {
       BlockSourceImpl impl = new BlockSourceImpl(worldObj, xCoord, yCoord, zCoord);
       BehaviorDefaultDispenseItem.doDispense(
           worldObj,
           it,
           6,
           BlockDispenser.func_149937_b(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)),
           BlockDispenser.func_149939_a(impl));
     }
     return null;
   }
 }